#include <iostream>
using namespace std;
//MainFunctions
int computeDiscount(int);
int mainProgram();
int main()
{
mainProgram();
}
int computeDiscount(int total)
{
if (total >= 10 && total <= 19)
{
total = (total-(total * .2));
cout << total;
}
}
int mainProgram()
{
int t;
cout << "What is the total amount for today? " << endl << ">>>";
cin >> t;
cout << "The total is: " << computeDiscount(t);
}
Output:
What is the total amount for today?
10
7The total is: 5007456
What do I do? I want seven to go where the "5007456" is appearing
If I put the function outside of the cout it works... Not sure
I want to call the function in the cout