+ 1
I am working on a code and it when compiling, it gives an error message...
error: expected primary Expression before '<<'.... What is this primary extension???
12 odpowiedzi
+ 5
I believe it said primary expression and not primary extension.
+ 2
you dont have anything on the left of ‘<<‘. If its a print (c++), make sure to add ‘cout’ before your insertion operators. If none of these, then be very careful where you place those things, like on newlines which will cause an error after you terminate the statement.
+ 1
So, how do I solve the problem?
0
int main()
{
char income[256];
int monthlyIncome;
float mmonthlyIncome = 1010.99;
// Configure the display to show monthly income.
cout.setf(ios::fixed); // no scientific notation please
cout.setf(ios::showpoint); // always show the decimal for real numbers
cout.precision(2); // two digits after the decimal
// Prompt the user for his income
cout <<"\tYour monthly income: " << endl;
cin >> monthlyIncome;
cout <<"Your income is: quot;
<< setw(9) << (float) monthlyIncome;
cout << endl;
return 0;
}
Please, at the end of the day, I want the input to look like this:
Your monthlyincome:
Your income is: $ 1010.99
0
but when I run that code, its output is 1010.00 instead of 1010.99
0
What is an explicit conversiu
0
Conversion