CyberCodes

Reminders sa mga rehistradong myembro:

•ang lengwahe na gagamitin ay pawang english at tagalog lamang

•Bawal po dito ang pakikipag away

•Bawal ang mga shorcut na mga words
Example: txt, Pwd, at iba pa

•Bawal mababastos at masasakit na salita o anu mang makakasakit
ng damdamin ng isang myembro ng forum na ito

•use the "like" button if the post of the following user you think are usefull


convert weight to pounds

Go down

Admin Post convert weight to pounds

Post by sandbox.exe on Sun Dec 02, 2012 6:34 pm

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;
        }
}
avatar
sandbox.exe
Code Casters
Code Casters

Posts : 36
Credits : 134
Fame : 13
Join date : 2012-11-03
Age : 26

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum