+ 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???

7th May 2019, 6:13 PM
Joshua Olaoye
Joshua Olaoye - avatar
12 odpowiedzi
+ 5
I believe it said primary expression and not primary extension.
7th May 2019, 11:58 PM
Sonic
Sonic - avatar
+ 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.
7th May 2019, 6:55 PM
Choe
Choe - avatar
+ 1
So, how do I solve the problem?
9th May 2019, 5:41 AM
Joshua Olaoye
Joshua Olaoye - avatar
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
8th May 2019, 5:38 PM
Joshua Olaoye
Joshua Olaoye - avatar
0
but when I run that code, its output is 1010.00 instead of 1010.99
8th May 2019, 5:39 PM
Joshua Olaoye
Joshua Olaoye - avatar
0
What is an explicit conversiu
10th May 2019, 1:44 PM
Joshua Olaoye
Joshua Olaoye - avatar
0
Conversion
10th May 2019, 1:44 PM
Joshua Olaoye
Joshua Olaoye - avatar