Variable Declaration in C++
Level 246 keystrokes
Declares two int variables, x = 10 and y = 20, and prints their sum, 30.
C++ code
// Declares the int variable x and stores the value 10 in it1int x = 10;// Declares a second int variable, y, with the value 202int y = 20;// Computes x + y (10 + 20) and prints 30; endl ends the line3cout << x + y << endl;Output
30
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this C++ code and how often they appear.
<× 4;× 3=× 2+× 1