please help me with this problem!

closed account (N0jhb7Xj)
thanks all for reading up until this point.

im a total noob and stuck on this problem

(Program) a. Write a C++ program to convert meters to feet. The program should request the
starting meter value, the number of conversions to be made, and the increment between metric
values. The display should have appropriate headings and list the meters and corresponding
feet value. If the number of iterations is greater than 10, have your program substitute a
default increment of 10. Use the relationship that 1 meter = 3.281 feet.

b. Run the program written in Exercise 6a on a computer. Verify that your program begins at
the correct starting meter value and contains the exact number of conversions specified in
your input data.









here is what have so far
#include<iostream>
#include <iomanip>
using namespace std;


// a programs to convert meter to feet
int main()

{
const int MAXMETER = 10;
const int STARTVAL = 1;
const int STEPSIZE = 1;
int meter;
double feet;

cout << "Meter Feet\n"
"------- -----\n";

meter = STARTVAL;

// set output for formats for floating-point numbers only
cout << setiosflags (ios::showpoint) << setiosflags(ios::fixed)
<< setprecision(2);

while (meter <= MAXMETER)
{
feet = (3.281) * meter;
cout << setw(4) << meter
<< setw(13) << feet << endl;
meter = meter + STEPSIZE;
}


system ("PAUSE");
return 0;
}





i dont know how to have a setup where you input the values, and then will be provided the output. i literally scoured my book for info on it


thanks alot in advance!!!
To get value just use cin >> meter;
closed account (N0jhb7Xj)
To get value just use cin >> meter;




thanks for the reply!!
Why do I keep having a problem with line 11
'cout << "meter feet\n"'
closed account (N0jhb7Xj)
also,


where would i place 'cin >> meter;'

thanks alot!!
where would i place 'cin >> meter;'

At the point in the code where you want the user to enter the value.
Topic archived. No new replies allowed.