Answer to Question #26606 in C++ for red rose

Question #26606
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
the corresponding feet value.Use the relationship that 1 meter = 3.281 feet.

write the above .programs using a for loop.
1
Expert's answer
2013-03-18T11:59:27-0400
#include <iostream>
#include <conio.h>

using namespace std;
//main function
int main()
{
int numberconversionsmade=0;//declare variable numberconversionsmade
double startvalue=0;//declare variable startvalue
double feetvalue=0;//declare variable feetvalue
cout<<"Enter starting meter value: ";
cin>>startvalue;//input startvalue
cout<<"Enter number of conversions to be made: ";
cin>>numberconversionsmade;
//using a for loop.
for(int i=startvalue;i<=startvalue+numberconversionsmade;i++){
feetvalue=3.281*i;//calculate feet
cout<<i<<" =
"<<feetvalue<<"
";//show result
}
getch();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS