Skip to content

Commit c52e8d5

Browse files
Basic
1 parent d6debc4 commit c52e8d5

7 files changed

+89
-1
lines changed

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"files.associations": {
3-
"ostream": "cpp"
3+
"ostream": "cpp",
4+
"iostream": "cpp"
45
}
56
}

a.exe

-44.5 KB
Binary file not shown.

array&pointer.cpp

Whitespace-only changes.

break_continue_statement.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main() {
5+
cout << "This is the example of break statement:" << endl;
6+
for (int i = 0; i < 10; i++) {
7+
cout << i << endl;
8+
if (i == 4) {
9+
break;
10+
}
11+
}
12+
13+
cout << endl;
14+
cout << "This is the example of continue statement:" << endl;
15+
for (int i = 0; i < 10; i++) {
16+
if (i == 4) {
17+
continue; // Skip the iteration when i is 4
18+
}
19+
cout << i << endl; // This line will now execute for all other values of i
20+
}
21+
22+
return 0;
23+
}

doWhile_loop.cpp

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*There are three types of loop in cpp
2+
1. for loop
3+
2. while loop
4+
3. do while loop
5+
*/
6+
7+
8+
#include<iostream>
9+
using namespace std;
10+
11+
int main(){
12+
13+
// FOR LOOP
14+
for (int i =0; i<10;i++){
15+
cout<<"Hi diya"<<endl;
16+
}
17+
18+
// WHILE LOOP
19+
int i =0 ;
20+
while(i<=10){
21+
cout<<"Fuck u samman!!"<<endl;
22+
i++;
23+
}
24+
25+
// EX OF INFINITE WHILE LOOP
26+
int j =1 ;
27+
while(true){
28+
cout<<j<<endl;
29+
j++;
30+
}
31+
32+
// DO WHILE LOOP :--> it will run the code atleast one time
33+
34+
int i=1;
35+
do{
36+
cout<<i<<endl;
37+
i++;
38+
}
39+
while(false);
40+
41+
return 0 ;
42+
}

pointers.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main(){
5+
int a= 3;
6+
int* b =&a;
7+
8+
// & --> (Address of ) Operator
9+
cout<<"The Address of a is "<<&a<<endl;
10+
cout<<"The Address of a is "<<b<<endl;
11+
12+
// * --> (value at ) Dereference operator
13+
cout<< "The value of b is "<<*b<<endl;
14+
15+
// Pointer to Pointer
16+
int**c = &b;
17+
cout<<"The address of b is "<<&b<<endl;
18+
cout<<"The address of b is "<<c<<endl;
19+
cout<<"The value at address c is "<<*c<<endl;
20+
cout<<"The value at address value_at(value_at(c)) is "<<**c<<endl;
21+
return 0;
22+
}
44.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)