This is going to be a very easy fix most likely, but I have been trying to program a simple program that asks for a monthly budget, the user then puts it in, then it outputs Your monthly budget with the number the user put in. I have coded half of the problem, but I keep getting your monthly income is and it doesn't display the number that I put it in earlier. I have looked everywhere and can't find my mistake, below is my code.
#include <iostream>
#include <iomanip>
int main ()
{ //declares the variable
float monthlyIncome;
//asks the user what their monthly income is
cout <<"\t"
<< "Your monthly income: ";
cin >> monthlyIncome
//configures the display to show monthly budget within 2 decimal places
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
//display the results
cout << "Your income is: "
<< setw(9) << "$" monthlyIncome;
return 0;
}
#include <iostream>
#include <iomanip>
usingnamespace std; //added
int main()
{ //declares the variable
float monthlyIncome;
//asks the user what their monthly income is
cout << "\t" << "Your monthly income: ";
cin >> monthlyIncome;
//configures the display to show monthly budget within 2 decimal places
cout << fixed << setprecision(2);
//display the results
cout << "Your income is: "<< setw(9) << "$" << monthlyIncome;
return 0;
}