I am totally new to programming and I'm feeling like an idiot. I need to write a c++ program, basically a cash register program is what I've been told it's commonly called. It needs to ask for amount owed, amount paid, and display the change and break the change down into dollars,quarters,dimes,nickels,pennies. If the amount paid is less then the amount owed it needs to display a message saying the customer owes whatever the difference is. I'm supposed to use a "nested if" here is what I have so far :
Code:
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
float a,b,c;
cout<<"Enter amount owed $ : ";
cin>>a;
cout<<"Enter amount paid $ : ";
cin>>b;
c=a-b;
cout<<"Your change is $ : ";
if (c>=0)
{ cout<<"You owe $ : ";
cout<<c*-1;
}
cout<<fixed;
cout<<setprecision(2);
cout<< c;
cout << endl << endl;
system("pause");
return 0;
}
And this is where I become totally lost, I don't really get how to break the change down. I'm not sure how to actually write the nested if.