[Practice 24.2] Expected primary-expression before ‘<‘ token | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

[Practice 24.2] Expected primary-expression before ‘<‘ token

Hello, I’m having troubles trying to fix this part of my code, any help would be appreciated :) #include <iostream> using namespace std; int main() { //your code goes here double temp; cin >> temp; if (temp =>36.1 && <=36.9) cout << "Ok"; else cout << "Not OK"; }

1st Mar 2021, 3:27 PM
Plaush
Plaush - avatar
5 Answers
+ 2
"temp >= " instead of 'temp=>" and also it will be "if (temp >=36.1 && temp <= 36.9)" or you can write it as "if (36.1<=temp<=36.9)" .
1st Mar 2021, 3:28 PM
Abhay
Abhay - avatar
+ 1
Abhay Thank you so much! I didn’t know minor changes in spacing and placement could affect the code so much. C++’s tad bit weird but I’ll get used to it
1st Mar 2021, 3:34 PM
Plaush
Plaush - avatar
+ 1
Plaush it's not about spacing , you can't do "=>" , it is "<=" .
1st Mar 2021, 3:38 PM
Abhay
Abhay - avatar
+ 1
Plaush a typo, ">=" not "<="
1st Mar 2021, 3:41 PM
Abhay
Abhay - avatar
0
Abhay Ahh ok :)
1st Mar 2021, 3:39 PM
Plaush
Plaush - avatar