-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic.cpp
52 lines (37 loc) · 1.21 KB
/
basic.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// In this file you can find a lot of basic competitive programming stuff in C++, I made it because I forget things easily
using namespace std; // you don't have to type out "std" each time
// include all standard libraries
// useful in competitive programming, not in software engineering
#include <bits/stdc++.h>
#define ll long long // just type "ll" instead of "long long"
#define ar array // ar instead of array
int main() {
int num;
//cin >> num; // input
//cout << "Hello World!\n"; // output
int n = 3, m = 5;
cout << n << " " << m << "\n"; // print two variables separated by space
// int m1 = max(n, m); // maximum
// int m2 = min(n, m); // minimum
ll big_number; // define a long long using our shortcut
// for loop
int iter = 10;
for(int i = 0; i < iter; i++){
cout << i;
}
cout << "\n";
// loop trough characters in string
string s1 = "ADBCDADB";
for (char d : s1){
cout << d;
}
cout << "\n";
// and = &&, if = ||, not = !
// ARRAYS AND VECTORS
// vector
vector<int> v;
v.push_back(3); // add elements
v.push_back(4);
cout << v.size(); // size of vector
return 0; // end of program
}