Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. The following code does not compile, citing an error of identifier Funk is undefined. Show/explain with code how to resolve the compile-time error. int

image text in transcribed

1. The following code does not compile, citing an error of identifier Funk is undefined." Show/explain with code how to resolve the compile-time error. int main() { // call Funk #49 Funk (49); void Funk (int i) { f = f * 2; 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. 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? (e) 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

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions