Write a program that produces a table converting distance in feet to distances in meters, for values of feet from 10 to 200, in steps of 10 feet. There are 39.37 inches in 1 meter, three feet in 1 yard, and 12 inches in 1 foot. You must use a loop.

I did:

# include <iostream>
# include <cmath>

using namespace std;

int main()
{

int i;
double inches = 39.37;
double feet = 3;
double foot = 12;
double meters = 39.37;
double yard = 3;

for (i=10; i=200; i++)
{
cout << "For values of feet from 10 to 200 are: " << feet << inches << foot << meters << yard << endl;
cin >> feet, inches, foot, meters, yard;
char feet;
break;
}

while (i<=200)
{
cout << "The conversion is " << endl;
}

return 0;
}

See the objective of the program is to convert from feet to meters. If you use the information that is given in the problem statement ... you see that
10 feet = 12 inches
1 inch= 1/39.37 metres
Therefore
10feet= 12*(1/39.37)metres

Now the program says that accept the input from the user. The user enters the value of feet. This value should be between 10 and 200. So when the user enters the input use a if condition to check if the value is indeed between 10 and 200.

If it is you use a loop to do the conversion. For example, if the user enters 30 feet, this contains 3 10 feets. Initialize a variable to 0. Add 12*(1/39.37) 3 times to the variable.

I hope this will help you to get further in your problem. Implement these points in your code. Read some tutorials on C/C++ programming to better your understanding of input/output, loops.

ALSO NEXT TIME USE CODE TAGS WHEN YOU ARE POSTING CODE

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.