Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
Thread: Borland C++ 5.02 program issues
09-26-2012, 02:58 AM #1
- Join Date
- Sep 2012
- New York
- Thanked 0 Times in 0 Posts
Borland C++ 5.02 program issues
I"m new to programming in C++, in fact I'm new to programming in total. I'm working on a project for school where I have to write a program that will act sort of as a piggy bank. The idea of the program is that it will ask for your name, how many weeks you have been saving up for, and how many pennies you have saved in total. It will then tel you many dollar bills, nickels, dimes, and quarters you can exchange it for.
The name doesn't matter what you put it in as, but I've been using 4 weeks as a baseline, with a total of 590 pennies saved up. It should tell me I could exchange it for 5 dollar bills, 3 quarters, 1 dime, and 1 nickel, however, when I put the 590 pennies in and the 4 weeks, it tells me I have saved $5.90 in 4 weeks, and I can exchange it for 5 dollar bills, 5 quarters, 5 dimes, and 0 nickels.
Here is a copy of my program: Note that it is in Borland C++ version 5.02 (1997)
cout<<"What is your name? ";
cout<<"How many weeks have you been saving up for? ";
cout<<"How many pennies have you save up? ";
cout<<"\n\nHi "<<name<<", you have saved up $"<<setprecision(2)<<total<<" in "<<weeks<<" weeks\n";
cout<<"\nYou can exchange this for the following:\n\n";
cout<<"\t\t\t- "<<dollars<<" Dollar Bills\n";
cout<<"\t\t\t- "<<quarters<<" Quarters\n";
cout<<"\t\t\t- "<<dimes<<" Dimes\n";
cout<<"\t\t\t- "<<nickels<<" Nickels\n";