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 823a3fd

Browse files
shaygas
0 parents commit 823a3fd

20 files changed

+414
-0
lines changed

‎.init_class_nocons.cpp.swp

12 KB
Binary file not shown.

‎.inline.cpp.swn

12 KB
Binary file not shown.

‎.inline.cpp.swo

12 KB
Binary file not shown.

‎.inline.cpp.swp

12 KB
Binary file not shown.

‎a.out

9.16 KB
Binary file not shown.

‎class.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#include<iostream>
2+
#include<string>
3+
using namespace std;
4+
class student
5+
{
6+
string student_name[20];
7+
int roll_no;
8+
int SAP_ID;
9+
string Specialisation[5];
10+
public:
11+
void Read_data()
12+
{
13+
cout<<"Enter Student's Name"<<endl;
14+
cin.getline(student_name);
15+
cout<<"Enter Roll number of student"<<endl;
16+
cin>>roll_no;
17+
cout<<"Enter SAP_ID of the student"<<endl;
18+
cin>>SAP_ID;
19+
cout<<"Enter the Specialisation of the student"<<endl;
20+
cin.getline(Specialisation);
21+
}
22+
void show()
23+
{
24+
cout<<"Name of the student is "<<student_name<<endl<<"ROll number of the student is "<<roll_no<<endl<<"SAP ID of the student is "<<SAP_ID<<endl<<"Specialisation of the student is "<<Specialisation<<endl;
25+
}
26+
};
27+
int main()
28+
{
29+
cout<<"Hello User!\nThis is the first programme of Classes"<<endl;
30+
student S;
31+
S.Read_data();
32+
S.show();
33+
return 0;
34+
}
35+
36+
37+
38+
39+
40+
41+
42+

‎constructor.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include<iostream>
2+
using namespace std;
3+
class nishkarsh
4+
{
5+
int sapid;
6+
string roll;
7+
public:
8+
nishkarsh(int sap,string rollnum)
9+
{
10+
sapid=sap;
11+
roll=rollnum;
12+
}
13+
void show()
14+
{
15+
cout<<"Sapid is "<<sapid<<endl<<"roll number is "<<roll<<endl;
16+
}
17+
};
18+
int main()
19+
{
20+
nishkarsh nish(500060720,"R171217041");
21+
nish.show();
22+
cout<<endl;
23+
return 0;
24+
}

‎copycons.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include<iostream>
2+
using namespace std;
3+
class nishkarsh
4+
{
5+
int sapid;
6+
public:
7+
nishkarsh()
8+
{
9+
sapid=500060720;
10+
}
11+
nishkarsh(nishkarsh &x)
12+
{
13+
sapid=x.sapid;
14+
}
15+
void show()
16+
{
17+
cout<<sapid<<endl;
18+
}
19+
};
20+
int main()
21+
{
22+
cout<<"Copy Constructor Program"<<endl;
23+
nishkarsh n;
24+
n.show();
25+
nishkarsh x(n);
26+
x.show();
27+
return 0;
28+
}

‎defaultarg.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include<iostream>
2+
using namespace std;
3+
float simple_interest(float p,int t,int rate=5);
4+
float simple_interest(float p,int t,int rate)
5+
{
6+
float SI;
7+
SI=(p*rate*t)/100;
8+
return SI;
9+
}
10+
int main()
11+
{
12+
float principal; int time;
13+
cout<<"Default Arguments program"<<endl;
14+
cout<<"Enter principal and time period in rupees and years respectively"<<endl;
15+
cin>>principal>>time;
16+
float Simple=simple_interest(principal,time);
17+
cout<<"Simple interest is "<<Simple<<endl;
18+
return 0;
19+
}
20+

‎destructor.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include<iostream>
2+
using namespace std;
3+
class nishkarsh
4+
{
5+
public:
6+
nishkarsh()
7+
{
8+
cout<<"I am constructor"<<endl;
9+
}
10+
~nishkarsh()
11+
{
12+
cout<<"I am Destructor"<<endl;
13+
}
14+
};
15+
int main()
16+
{
17+
cout<<"Constructor vs Destructor programme"<<endl;
18+
cout<<"I am in main"<<endl;
19+
nishkarsh n1;
20+
{
21+
cout<<"I am in main block 1"<<endl;
22+
nishkarsh n2;
23+
{
24+
cout<<"I am in main block 2"<<endl;
25+
nishkarsh n3;
26+
}
27+
cout<<"I am in main block 1"<<endl;
28+
}
29+
cout<<"I am in main"<<endl;
30+
return 0;
31+
}
32+

0 commit comments

Comments
(0)

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