Hello I am a very new to C++. I am trying to convert a given number of meters and centimeters into feet and inches using three function. I think that I am close but since i am new I am having a hard time figuring out what i have done wrong. Thanks,
Code:#include <iostream> using namespace std; double unitconversion (double lengthme, double lengthcent); void unitoutput (double lengthme, double lengthcent); int main () { double lengthme, lengthcent; char answer; do { cout<<"Enter a length in meters and centimeters to be converted:"; cin>>lengthme>>lengthcent; cout<<unitoutput (lengthme, lengthcent); cout<<"\n Test again (y/n)"; cin>>answer; cout<<endl; }while (answer== 'y' || answer== 'y'); system ("PAUSE"); return 0; } double unitconversion (double lengthme, double lengthcent) { lengthme=lengthme/0.3048; lengthcent=lengthcent/100; lengthcent=lengthcent/0.3048; lengthcent=lengthcent*12; return (lengthme, lengthcent); } void unitoutput (double lengthme, double lenghtcent) { cout<<"The length is "<<lengthme<<" ft and "<<lengthcent<<" in.\n"; }



LinkBack URL
About LinkBacks


