Last active
April 10, 2016 08:01
-
-
Save lynas/3f89d0f812d12a935e2d88307e22e61d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
string box1 = "good"; | |
string box2 = "bad"; | |
cout<< "Sakib " + box1 + box2+"\n"; | |
cout << "\n"; | |
// variable | |
int var1 = 5; | |
double var2 = 6.6; | |
string name = "Sakib"; | |
cout << var1; | |
cout << "\n"; | |
cout << var2; | |
cout << "\n"; | |
cout << name; | |
cout << "\n"; | |
cout << "\n"; | |
cout << (2+2); | |
cout << "\n"; | |
cout << "\n"; | |
// condition | |
/* | |
multi | |
line | |
comment | |
*/ | |
int x1 = 2; | |
if(x1==5){ | |
cout << " this is 5"; | |
} | |
else if(x1>5){ | |
cout << " this is grater than 5"; | |
} | |
else{ | |
cout << " something else"; | |
} | |
cout << "\n"; | |
cout << "\n"; | |
// for loop | |
// 1+2+3+4+5+6 | |
int res = 0; | |
for( int i=1; i<=6;i++){ | |
res = res+i; | |
} | |
cout<< res; | |
cout << "\n"; | |
cout << "\n"; | |
// 2+4+6+8+10 | |
int res2 = 0; | |
for( int i=2; i<=10;i=i+2){ | |
res2 = res2+i; | |
} | |
cout<< res2; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment