Cpp_Programming_Notes
Cpp_Programming_Notes
1. Preprocessor Directives: Code that runs before the actual program starts.
Example Program:
int main() {
- #include <iostream>: This line tells the program to include the iostream library, which is needed to
- int main(): This is the main function where the program starts. Every C++ program needs a main()
function.
- std::cout: This is used to output text to the console (screen). std::endl adds a new line.
In C++, variables are used to store data. A variable needs a type (what kind of data it holds) and a
name.
Declaring Variables:
You need to declare a variable before you use it. Here's how you declare different types:
Example Code:
#include <iostream>
int main() {
return 0;
Exercise 1: