c++ Program ASSIGNMENT 2 – Write all the code… Write a program from scratch, tha
ID: 3869826 • Letter: C
Question
c++
Program ASSIGNMENT 2 – Write all the code…
Write a program from scratch, that asks a person how tall they are.
“How many feet and how many inches are you”
“How tall are you: “
Feet: 5 ß they enter 5
Inches: 4 ß they enter 4
Write code that calculates how many total inches high they are. ( Hint: there 12 inches to a foot )
Output the results.
Example output: “You are 64 inches high”
Program ASSIGNMENT 3 – Write all the code…
Write a program from scratch given these declarations and assignments: double a = 18, b = 6, c = 3, and that calculates the answers for:
cout << a + b / c;
cout << ( a + b ) / c;
cout << a + ( b / c );
Explain the difference or similarity in the answers.
Output the results
Explanation / Answer
#include <iostream>
using namespace std;
int main () {// start program
int feet, inches, height;
cout<<"Enter Feet: ";
cin >> feet;
cout<<"Enter Inches: ";
cin >> inches;
height = feet * 12 + inches;
cout<<"You are "<<height<<" inches high"<<endl;
return 0;
} // end of program
Output:
ASSIGNMENT 3
Answer:
cout << a + b / c; will print 20
18 + 6 /3 = 18 + 2 = 20
cout << ( a + b ) / c; will print 8
(18 + 6) / 3 = 24 / 3 = 8
cout << a + ( b / c ); will print 20
18 + 6 /3 = 18 + 2 = 20
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.