+ 2

(C++) error: expected primary-expression before '<<' token

I get it on the line cout << ("and a mass of ") << mass << ("x10^") << power << (". "); but on the Android app the ^ doesn't line up so I don't know what it refers to, but I think it was the << after 'of ")' how can I fix these?

28th Mar 2017, 8:13 AM
Jeremy Hunter
Jeremy Hunter - avatar
5 Antworten
+ 4
Hi Dev. I only just saw your response but I've fixed it now. Misplaced ; :)
30th Mar 2017, 5:27 PM
Jeremy Hunter
Jeremy Hunter - avatar
+ 3
Try this one std::cout << "and a mass of " << mass << "x10^" << power << ". "; or add using namespace std; before main()
28th Mar 2017, 8:38 AM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar
+ 2
Please write by removing parenthesis, it will work cout << "and a mass of " << mass << "x10^" << power << ". ";
28th Mar 2017, 8:29 AM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar
+ 2
same error, just without parentheses.
28th Mar 2017, 8:32 AM
Jeremy Hunter
Jeremy Hunter - avatar
+ 2
Can I see your code?
28th Mar 2017, 8:35 AM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar