ok I am trying to use setprecision to set a dollar amount.
'''
#include <cstdlib>
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int days;
double total;
double daily;
cout << "App to calculate pay if 1 cent was earned on day 1 and doubled every day\n";
cout << "------------------------------------------------------------------------\n\n";
cout << "Enter number of days: ";
cin >> days;
for (int i = 1; i <= days; i++) {
total += daily;
daily *= 2;
}
cout << "Your total pay will be $" << total / 100 << endl;
return 0;
}
'''
gets me this output "Your total pay will be $1.52017e-317"
when i change the final cout to this...
'''
cout << "Your total pay will be $" << fixed << setprecision(2) << total / 100 << endl;
'''
I get "gets me this output "Your total pay will be $0.00"
It makes everything zero dollars?
I am confused.........