Well, it turns out. I have to use the MODULUS OPERATOR, and the math didn't work for Microsoft Visual C++ 6.0 anyways. It worked on Dev C++, but at school we use Microsoft.
Here's what I have so far for the program, all I need is the math for the nickels and pennies. The quarters and dimes seem to be working.
#include %26lt;iostream.h%26gt;
main()
{
int quarters;
int dimes;
int nickels;
int pennies;
int number;
cout %26lt;%26lt; "Enter a number. " %26lt;%26lt; '\n';
cin %26gt;%26gt; number;
quarters = number / 25;
dimes = number % 25 / 10;
nickels = I need help here
pennies = I need help here
cout %26lt;%26lt; "Quarters - " %26lt;%26lt; quarters %26lt;%26lt; '\n';
cout %26lt;%26lt; "Dimes - " %26lt;%26lt; dimes %26lt;%26lt; '\n';
cout %26lt;%26lt; "Nickels - " %26lt;%26lt; nickels %26lt;%26lt; '\n';
cout %26lt;%26lt; "Pennies - " %26lt;%26lt; pennies %26lt;%26lt; '\n';
cout %26lt;%26lt; '\n
return 0;
}
Change program (using MODULUS OPERATOR)?
Microsoft requires using namespace, replace the following line of code:
#include %26lt;iostream.h%26gt;
with this one:
#include %26lt;iostream%26gt;
using namespace std;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment