C++ Constants/Literals

Get introduced to constants in C++.

Constants or literals #

Let’s write a program in which we will overwrite the value of a variable.

Run the code below and see the output!

Press + to interact
#include <iostream>
using namespace std;
int main() {
int number = 10;
cout << "Number = " << number << endl;
number = 20;
cout << "Number = " << number << endl;
number = 30;
cout << "Number = " << number << endl;
}

In the above code, we have declared a variable number. We see that we can overwrite the ...