Question: Please solve those two problems 2. Write a C++ function RoundToNearest, which takes a positive double parameter and returns the inte- ger nearest that double

 Please solve those two problems 2. Write a C++ function RoundToNearest,

Please solve those two problems

2. Write a C++ function RoundToNearest, which takes a positive double parameter and returns the inte- ger nearest that double by rounding it. (Example: RoundToNearest(6.4) = 6, Round ToNearest(6.5) - 7.) Write your function using only a single line of code in the function body, and without using any rounding functions from the C++ standard library. (Your code should not call any functions at all and should consist entirely of arithmetic.) 3. Ada downloads the file doors.h from the Lecture 2 and saves it to her Desktop on her Windows PC. She then sets up a C++ project in Visual Studio and notes that Visual Studio saved the project on her hard drive at the location C:\AdaProjects Question. She adds doors. to her project by using the "Add Existing Item" option in Visual Studio; this option references the file doors.h in the project, but does not copy it to the project folder. She adds a new file to the project called main.cpp, and notes that Visual Studio puts the new file in the folder C:\AdaProjects\Question3. She writes this code ini main.cpp: #include #include "doors.h" int main(int argc, char* argv[]) { // call function from doors.h int p = getPrizeDoor(); When Ada compiles her file, she gets the following error message: Could not open include file: doors.h': No such file or directory (a) Where is the compiler looking for the file iostream? (You may need to research this.) (b) Where is the compiler looking for the file doors.h? (c) Why can't the compiler locate doors.h? (d) What's the moral of the story here

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!