0
Guys what's the problem they tell me I can't convert string to integar but I learned that I can
https://sololearn.com/compiler-playground/cv64bt3kABlk/?ref=app
3 Antworten
+ 7
int x=age1>18? "you can enter":"you cant enter";
Look at this line carefully.
You're storing "you can enter" which is a string in int x datatype.
That's why error is occurring
+ 6
Blood Waolf ,
the variable x is defined as an *integer type*, so we can not assing one of the strings to it. making x a string type, it will work.
+ 2
Thank