convert weight to pounds
Page 1 of 1
convert weight to pounds
Create a program that will ask the user to enter the name of your father and mother and the weight of he/she mother and father then it well calculate the average weight and converted to pounds.
- Code:
#include<iostream.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
int main()
{
top:
system("cls");
char fname[50],mname[50],ans;
int fwt, mwt;
double ave, lbs;
cout<<"Enter your father's name: ";
cin>>fname;
cout<<"Enter your father's weight(kg): ";
cin>>fwt;
cout<<"\nEnter your mother's name: ";
cin>>mname;
cout<<"Enter your mother's weight(kg): ";
cin>>mwt;
ave = (fwt + mwt)*0.5;
lbs = ave*2.2;
cout<<"\nTotal weight average is: "<<lbs<< " lbs.\n\n";
cout<<"\n\nEnter another data? [Y]Yes or [N] No: ";
cin>>ans;
cout<<endl<<endl<<endl;
if (ans == 'n'|| ans == 'N'){
return 0;}
else if (ans == 'y' || ans == 'Y'){
goto top;}
else
{
cout<<"Invalid input"<<endl;
}
}
sandbox.exe- Code Casters
- Posts : 36
Credits : 134
Fame : 13
Join date : 2012-11-03
Age : 33
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum