Professional Documents
Culture Documents
Basics of C++ Notes
Basics of C++ Notes
By - Himanshu Rawat
Skeleton of C++
#include <iostream>
Int main (){
std::cout << “hello” << std::endl;
return 0;
}
Some other libraries
#include <iostream>
using namespace std;
int main (){
int a;
cin >> a;
cout << "the given input is: " << a;
return 0;
}
Data Type - 1 int
#include <iostream>
using namespace std;
int main (){
//integer
int a=10;
//long
long b=15;
return 0;
}
2 Float and double
#include <iostream>
using namespace std;
int main (){
//float and double
float a = 10.6;
Float b = 5;
double c= 6.564646;
return 0;
}
3 string
#include <iostream>
using namespace std;
int main (){
//string
string s;
cin >> s;
cout << s
return 0;
}
4 getline
#include <iostream>
using namespace std;
int main (){
//getline
string str;
getline (cin, str);
cout << str;
return 0;
}
5 char
#include <iostream>
using namespace std;
int main (){
//char
char ch;
cin >> ch;
cout << ch;
return 0;
}
Operation on array
2d Array