Start New Discussion within our Software Development Community

Yep. I have no life. Here's the simplest and stupidest form of C++ coding ever known to man kind...the change counter.

What does it do? Count change :-)

#include <iostream.h>
#include <conio.h>
#include <math.h>

int main ()
{
    int halfdollar = 0, quarters = 0, dimes = 0, nickels = 0, pennies = 0;
        
    cout << "Change Calculator \n \n";
    cout << "How many half dollars do you have? \n ";
     cin >> halfdollar;
    cout << "How many quarters do you have? \n ";
     cin >> quarters;
    cout << "How many dimes do you have? \n ";
     cin >> dimes;
    cout << "How many nickels do you have? \n ";
     cin >> nickels;
    cout << "How many pennies do you have? \n ";
     cin >> pennies;
    
    cout << "\n You have a total of : $" << float (((halfdollar * 50) + (quarters * 25) + (dimes * 10) + (nickels * 5) + (pennies * 1))) / 100;
    
getch();
return 0;
}