Just looking at this, there seems to be very little you've actually done. I don't program that much, if any, and I probably could have framed out what you've got there, no offense.
What part are you stuck on? I wouldn't write any code for you, but wouldn't you first want to start by looking for a formula to convert grams to ounces, or something similar, and integrating that into your calculate function? The functions for input and output should be fairly basic, too-- your textbook should clearly outline how to deal with user input and output, as that's something EVERY program should do.
I mean, if you know 1 kilo is = 1000 grams, 1 lb is 16 oz, and 1 kilo is = 2.20046 lbs, you can figure it all out:
1 kilo = 35.20736 ounces
so
1 gram = 0.03520736 ounces
There you go right there. Just being me, and I'm sure someone will come with a better way if I'm wrong, I'd get the input in kilos and grams. Then, convert the kilos to grams. Convert the total grams to ounces, and then work out how many pounds and ounces are in that amount(use a modulus for that? I dunno...)
Disclaimer: I'm not a programmer, but that's what I'd think to do logically. Take someone else's advice before mine, or use my advice only in the event of a lack of more suitable advice. ;)
alc6379
Cookie... That's it
2,820 posts since Dec 2003
Reputation Points: 186
Solved Threads: 147
in fact, he's done nothing at all beyond declaring some variables and function prototypes (which were probably just copied from the assignment paper).
Do your own homework kama, it's the only way you'll ever learn anything.
Questions like yours make me believe there should be a minimum requirement of a college degree to be allowed onto the internet...
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
#include<iostream.h>
Don't use that. It's 10 years out of date (I know, the oldest book that lists the proper way is about 10 years old).
void main()
Don't use, it's an abomination.
And lastly, don't do peoples' homework for them. It teaches them not to think and to be lazy and never learn the craft.
I don't want lazy poorly trained people as my future colleagues, it means I'll be doing more overtime doing their work and correcting their mistakes while they sit at home watching Wheel Of Fortune...
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
For pseudocode it looks like you're on the right track. [For actual code, there are a number of syntactical issues.]
But what are you doing with ounces? You ask for it, but never use it. Similarly, are you planning to do something with grams?
Please learn to use [CODE][/CODE] tags.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
When you pass parameters to a function and you want to modify those parameters within that function, you'll need to pass the parameter by reference or by using a pointer. Otherwise the value will not be changed in the calling routine.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
varunrathi:
Don't post whole solutions for people on the forum. We're not here to hand-hold, we're here to help people learn.
alc6379
Cookie... That's it
2,820 posts since Dec 2003
Reputation Points: 186
Solved Threads: 147