c++ Program ASSIGNMENT 1 – Fix the code 1) This code has errors. Do not delete l
ID: 3869823 • Letter: C
Question
c++
Program ASSIGNMENT 1 – Fix the code
1) This code has errors. Do not delete lines, Do not add lines. Only fix lines if needed. // add comment to end of line describing fix. Compile good code, Put Good code in MS Word document with Screen print of good output.
Note: MAC users may have to comment out a few lines, as indicated.
# iostream>
using namespace std;
Int main ( ) / / start program
/ Declare and Initialize Variables
int height = 0;
int feet = 0
Int inches = 0;
// Prompt for height
cout >> “Enter your height in inches: ‘;
cin >> Height;
// Calculate Height in feet and inches
height / 12 = feet;
inches = height % 12;
/Print out height in feet and inches
coutt << “You are “ < FEET << “ feet and “ <> inches >> “inches” ;
system(“pause”); // Mac user comment out this line by placing // in front of it.
// PC users -Hint replace the “ with the ones on your computer–coping code cause error, so just type it.
return 0;
} // end of program
Explanation / Answer
Hi,
I have fixed the issues.
#include <iostream>
using namespace std;
int main () {// start program
// Declare and Initialize Variables
int height = 0;
int feet = 0;
int inches = 0;
// Prompt for height
cout << "Enter your height in inches: ";
cin >> height;
// Calculate Height in feet and inches
feet = height / 12 ;
inches = height % 12;
//Print out height in feet and inches
cout << "You are " << feet << " feet and " << inches << " inches" ;
system("pause"); // Mac user comment out this line by placing // in front of it.
// PC users -Hint replace the “ with the ones on your computer–coping code cause error, so just type it.
return 0;
} // end of program
Output:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.