Lab 1
Lab 1
Introduction to C++
Objective:
What is C++?
#include <iostream>
2. Namespace: The using namespace std; statement allows usage of standard C++ elements
without prefixing them with std::.
3. Main Function: The entry point of a C++ program.
int main() {
return 0;
}
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!" << endl;
return 0;
}
Output:
Hello, World!
#include <iostream>
using namespace std;
int main() {
int age;
cout << "Enter your age: ";
cin >> age;
cout << "Your age is " << age << endl;
return 0;
}
Example Run:
Arithmetic Operators: +, -, *, /, %
Relational Operators: ==, !=, >, <, >=, <=
Logical Operators: &&, ||, !
Assignment Operators: =, +=, -=, *=, /=, %=
./program
Tasks: