Whats the error in this code ?[Solved] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
31st Jan 2022, 8:39 AM
マッドキング♣️✨♣️ [MadKing]
マッドキング♣️✨♣️ [MadKing] - avatar
3 Answers
+ 2
Hey. I guess the ternary operator does not work this way unfortunately. You just have to use the old-fashioned if-else statement. What you can do is store the result in a string first: string result = isPrime(12) ? "Yes" : "No"; cout << result;
31st Jan 2022, 9:24 AM
The_Fox
The_Fox - avatar
+ 1
The_Fox Thanks buddy
31st Jan 2022, 9:38 AM
マッドキング♣️✨♣️ [MadKing]
マッドキング♣️✨♣️ [MadKing] - avatar
+ 1
@MadKing You are very welcome
31st Jan 2022, 9:42 AM
The_Fox
The_Fox - avatar