Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f880413

Browse files
Add .cpp file
1 parent 77e5a41 commit f880413

File tree

4 files changed

+43
-1
lines changed

4 files changed

+43
-1
lines changed

‎02)add.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ using namespace std;
33

44
int main()
55
{
6-
int a = 5, b = 3;
6+
int a = 5, b = 2;
77
cout << "Sum of " << a << " and " << b << " is " << a + b;
88
return 0;
99
}

‎13)typeCasting.cpp‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
int a = 343;
7+
float b = 87.94;
8+
9+
cout << (float)a / 34 << endl;
10+
cout << (int)b;
11+
12+
return 0;
13+
}

‎14)strings.cpp‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
string name = "Mooazam";
7+
8+
cout << "The name is " << name << endl;
9+
cout << "The length of name is " << name.length() << endl;
10+
cout << "The name is " << name.substr(1, 155) << endl;
11+
cout << "The name is " << name.substr(2, 3);
12+
13+
return 0;
14+
}

‎15)pointers.cpp‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
float a = 34.34;
7+
float *ptra;
8+
ptra = &a;
9+
cout << "The value of a is " << a << endl;
10+
cout << "The value of a is " << *ptra << endl;
11+
cout << "The address of a is " << &a << endl;
12+
cout << "The address of a is " << ptra << endl;
13+
14+
return 0;
15+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /