π₯οΈ What I Learned
Text vs Expressions:
"4"
is just text, while4 + 3
is an expression that actually gets computed.Variables:
Variables are like containers that hold data. You can store, update, and reuse values throughout your program.
π» Example Code
#include <iostream>
using namespace std;
int main() {
// Printing text vs expression
cout << "4" << endl; // Just prints the text 4
cout << 4 + 3 << endl; // Computes and prints 7
// Working with variables
int x = 5; // store 5 in x
cout << x << endl;
x = 8; // update x to 8
cout << x << endl;
x += 3; // add 3 to x (now x = 11)
cout << x << endl;
return 0;
}
π Takeaway
Variables make your code flexible. Instead of hardcoding numbers everywhere, you store values in containers and update them when needed. Itβs like giving your code memory.
#100DaysOfCode #LearnInPublic #CodeNewbie #C++ #Programming
Top comments (0)