Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Closed Thread
 
Thread Tools Display Modes
Old Feb 14th, 2005, 12:48 PM   #1
breskoad
Newbie
 
Join Date: Feb 2005
Posts: 1
Rep Power: 0 breskoad is on a distinguished road
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?
breskoad is offline  
Old Feb 14th, 2005, 3:08 PM   #2
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
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
Mjordan2nd is offline  
Old Feb 14th, 2005, 3:49 PM   #3
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Unfortunately, we don't do homework. We do, however, help with it.

And who's Nancy? :p
__________________
Me :: You :: Them
Ooble is offline  
Old Feb 14th, 2005, 4:48 PM   #4
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
Quote:
Originally Posted by Ooble
And who's Nancy? :p
I was thinking the same thing.
__________________
"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
Mjordan2nd is offline  
Old Feb 14th, 2005, 7:22 PM   #5
gardon
Programmer
 
Join Date: Dec 2004
Posts: 87
Rep Power: 4 gardon is on a distinguished road
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
gardon is offline  
Old Feb 14th, 2005, 9:06 PM   #6
Hockeyman
Programmer
 
Hockeyman's Avatar
 
Join Date: Jan 2005
Location: Vancouver, Canada
Posts: 60
Rep Power: 4 Hockeyman is on a distinguished road
Send a message via MSN to Hockeyman
try

#include <iostream>
__________________
~ You know, Hobbes, some days even my lucky rocketship underpants don't help. ~

Hockeyman is offline  
Old Feb 15th, 2005, 7:32 AM   #7
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
They should work.

#include <iostream>
using namespace std;

int main {
    string dummy;
    
    cout << "Hi there." << endl;
    cin >> dummy;
    return 0;
}
Try that.
__________________
Me :: You :: Them
Ooble is offline  
Old Feb 15th, 2005, 3:44 PM   #8
gardon
Programmer
 
Join Date: Dec 2004
Posts: 87
Rep Power: 4 gardon is on a distinguished road
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.
gardon is offline  
Old Feb 15th, 2005, 3:48 PM   #9
Benoit
Expert Programmer
 
Benoit's Avatar
 
Join Date: Sep 2004
Location: Ontario, Canada
Posts: 550
Rep Power: 4 Benoit is on a distinguished road
Quote:
Originally Posted by breskoad
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?

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
Benoit is offline  
Old Feb 15th, 2005, 3:59 PM   #10
Hockeyman
Programmer
 
Hockeyman's Avatar
 
Join Date: Jan 2005
Location: Vancouver, Canada
Posts: 60
Rep Power: 4 Hockeyman is on a distinguished road
Send a message via MSN to Hockeyman
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. ~

Hockeyman is offline  
Closed Thread

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:28 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC