![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Feb 2005
Posts: 1
Rep Power: 0
![]() |
New programmer needs help
I have to write a program and i'm lost. I have to use C++ and have a program that does the following.
What's your name? Andrew How many pennies do you have Nancy? 77 How many nickels do you have Andrew? 30 How many dimes do you have Andrew? 2 How many quarters do you have Andrew? 5 ==================================================== Andrew's Net Worth ==================================================== Dollars : 3 Change : 72 ==================================================== Your program should use the following values 45 pennies, 27 nickels, 15 dimes and 7 quarters. It's for a sample class i'm taking, not necessarily homework. Any chance someone could code a program like that for me so i can see how it is done. Its a sample from my C++ book and i can't figure it out even though i've tried NUMEROUS codes. It takes your name input and then asks you how much change you have in forms of quarters, nickels, dimes, and pennies then calculates it into a dollar amount with remaining change. Can anyone give me a hand? Possibly show me the code for it? |
|
|
|
|
#2 |
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
It's a simple program. Show us the program in which you got closest, and we'll correct it.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower |
|
|
|
|
#3 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Unfortunately, we don't do homework. We do, however, help with it.
And who's Nancy? :p |
|
|
|
|
#4 | |
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
Quote:
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower |
|
|
|
|
|
#5 |
|
Programmer
Join Date: Dec 2004
Posts: 87
Rep Power: 4
![]() |
Woah, I just realized something. Standard cout and cin functions don't work on my compiler....
microsoft visual studio.net 2003 enterprise architect What include file do I include? Lol this seems very basic, but it's one thing I just can't get (I was using another compiler) I tried using <iostream.h> and <iostream> using namespace std; how can I use standard cout functions?!? lol |
|
|
|
|
#6 |
|
Programmer
|
__________________
~ You know, Hobbes, some days even my lucky rocketship underpants don't help. ~ read my blog @ My Lucky Rocketship Underpants
|
|
|
|
|
#7 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
They should work.
#include <iostream>
using namespace std;
int main {
string dummy;
cout << "Hi there." << endl;
cin >> dummy;
return 0;
} |
|
|
|
|
#8 |
|
Programmer
Join Date: Dec 2004
Posts: 87
Rep Power: 4
![]() |
Screw you, I got a new compiler, which probably beats everyone's here, and I didn't know what the new variation of iostream was.
Isn't the point of asking questions to find answers? it was a 2 second answer. |
|
|
|
|
#9 | |
|
Expert Programmer
Join Date: Sep 2004
Location: Ontario, Canada
Posts: 550
Rep Power: 4
![]() |
Quote:
You really should post code that you have attempted, then people will be more likely to help you...The easiest way I see to do this program is multiply how many of each coins you have by their value and just add it to the total
__________________
Johnny was a chemist's son but Johnny is no more, for what Johnny thought was H2O was H2SO4 |
|
|
|
|
|
#10 |
|
Programmer
|
That's a pretty bold attitude for someone asking us for help.
Two points for you: a) You highjacked a thread to ask a question, you got two answers within a day. That's nothing to complain about. b) When you ask a question, you are hoping that someone will take the time out of their own busy lives to anwser you. Try to remember that it isn't mandatory that anyone here takes that time, and the more attitude you toss around, the less likely it is that someone actually will.
__________________
~ You know, Hobbes, some days even my lucky rocketship underpants don't help. ~ read my blog @ My Lucky Rocketship Underpants
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|