← Back to Question List
C++ Code Walkthrough #23
Nested Ternary Evaluation
📄 Code
Read carefully — what does this print?1#include <iostream>2#include <string>3using namespace std;4int main() {5 int n = 0;6 string s = n > 0 ? "positive" : n < 0 ? "negative" : "zero";7 cout << s << endl;8 return 0;9}