RSS Forums RSS
Please support our C++ advertiser: Programming Forums

Need help with this conversion program

Join Date: Nov 2004
Location: tiny island in indian ocean
Posts: 138
Reputation: anastacia is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 1
anastacia's Avatar
anastacia anastacia is offline Offline
Junior Poster

Re: Need help with this conversion program

  #9  
Dec 1st, 2004
hi well first of let me see if got ur question right.
u need to input a weight value in kilograms and in grams separately and give the corresponding output in pounds and ounces right. well if so just 4 get the loop 4 the time being. i would suggest that u concentrate on input process and output. this is wat i think should be done

#include<iostream.h>
#include<conio.h>
#include<math.h>
#define pound 2.0246;
void main()
{
int kilo,gram,pound=1,ounce=1;
int answerp,answero;

// inputing data
cout<<" Please enter the weight in kilos: ";
ciin>>kilo;
cout<<" Please enter the grams: ";
cin>>gram;

// convert kilo and gram into pound and ounces
answerp=kilo*pound;
answero=( gram*16*pound)/1000;
// this will compute data separately for the kilo part and gram part
// to display them saparately
cout<<kilo<<" is valued to" <<answerp"pounds"<<endl;
cout<<gram<<" is valued to" <<answero<<ounces"<<endl;
getch();
}
this should work
1 more tip always do ur program part by part
hope that it will work
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 9:23 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC