Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions

Question

Why do mergers and acquisitions have such an impact on employees?

Answered: 1 week ago

Question

2. Describe the functions of communication

Answered: 1 week ago