problem with project

Hi everyone. I am new here and here is what I have going on. I have been working on a project for my Beginners C++ class. I need to make my code to not accept letters as input and I need to give the user the option to choose between inches and feet. Here is my code thus far. Any help is appreciated.

#include <cmath>
#include <iostream>
#include <iomanip>
using namespace std;


int main()
{
double length; //variables for fish tank dimensions with volume and liquid
double width;
double height;
double volume;
double gallons;
char do_again;





do
{


cout<<" the fish tank project2"<<endl; //name of program



cout<<"what is the length of your tank"<< endl;
cin>> length; //user inputs length of tank





cout<<"okay, now the width"<<endl;
cin>> width; // user inputs width of tank

cout<<"and now the height"<<endl;
cin>> height; // user inputs height of tank


cout.setf(ios::fixed);
<< setprecision (2)<< volume << endl; //rounds deciaml
volume= length * width * height; //process to caclculate volume
cout<<"the volume of your fish tank in cubic inches is "



gallons= (0.004329) * volume; //process in which to calculate gallons
cout <<"gallons in fish tank are "
<< setprecision (3) << gallons << endl; //rounds deciaml



cout<<"would you like to try this again y/n" <<endl;
cin>> do_again;
}while(do_again=='y');



system ("pause");

return 0;
}

I think...I dont know. Any help is greatly appreciated
What you have posted above doesn't compile - there are some errors
and this part is definitely not right:
1
2
3
4
cout.setf(ios::fixed);
<< setprecision (2)<< volume << endl; //rounds deciaml
volume= length * width * height; //process to caclculate volume
cout<<"the volume of your fish tank in cubic inches is " 

Topic archived. No new replies allowed.