forked from tanmayhinge-zz/competitive-programming-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsyntax.cpp
48 lines (37 loc) · 1.13 KB
/
syntax.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
#include<bits/stdc++.h> // header files, here this particular header file imports all the things you need for competitive programming
using namespace std; // specifies that we are working in the "standard" namespace, so basically you dont need to write std:: before all the iostream specific stuff...
/*
MULTI
LINE
COMMENT
*/
int main(){ // entry point for the program
int a = 31; // integer declaration
int b; // integer declaration
b = a; // b takes the value of a
string s1 = "hello s1";
string s2("hello s2");
bool test = 1>2;
cout<<a; // output a variable
cout<<endl; // output a new line
cout<<"Hello World"; // output a string
cout<<"Hey "<<s1 <<" "<<b <<endl; // multiple outputs
if(a == 1){ // self explainatory
cout<<"a is 1"<<endl;
}
else if(a!=1){ // self explainatory
cout<<"a is not 1" <<" it is actually"<<a<<endl;
}
else{
cout<<"a is "<<a<<endl;
}
int d[3] = {1, 2, 3};
for(int i = 0; i<3; ++i){
cout<<d[i]<<" ";
}
cout<<endl;
cout<<endl;
for(auto i:d){
cout<<i<<" ";
}
}