Sep 11, 2016 at 7:17pm UTC
So, when I run this code, it gives me 2.96413e-307, but when I set wage to a fixed double, it gives me 12.75 (I'm using 8.50 as my wage). How do I make sundaywage come out as 12.75 while using an unfixed variable? (wage)
#include <iostream>
#include <math.h>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
double wage;
double sundaywage = wage * 1.5;
int exit;
cout << "Please input your wage: ";
cin >> wage;
cout << endl;
cout << "Your wage is ";
cout << wage << endl;
cout << "Your Sunday wage is ";
cout << sundaywage << endl;
return 0;
}
Sep 11, 2016 at 7:23pm UTC
You need to wait until after you have given wage a value before you calculate the value of sundaywage .
Sep 11, 2016 at 7:34pm UTC
Thank you so much. lol Sorry, im just learning c++ and rewriting one of my old python programs in c++ and i was having trouble with the basics.