File tree Expand file tree Collapse file tree 5 files changed +127
-0
lines changed
Expand file tree Collapse file tree 5 files changed +127
-0
lines changed Original file line number Diff line number Diff line change 1+ #include < iostream>
2+ using namespace std ;
3+ void show1 ();
4+ inline void show2 ();
5+ void show1 ()
6+ {
7+ cout<<" Not inline" <<endl;
8+ }
9+ inline void show2 ()
10+ {
11+ cout<<" Inline" <<endl;
12+ }
13+ int main ()
14+ {
15+ cout<<" Lets do inline vs non inline maen" <<endl;
16+ show1 ();
17+ // show2();
18+ return 0 ;
19+ }
Original file line number Diff line number Diff line change 1+ #include < iostream>
2+ using namespace std ;
3+ class time
4+ {
5+ int hours,minutes,seconds;
6+ public:
7+ void gettime ()
8+ {
9+ cout<<" Enter hours,minutes and seconds respectively" <<endl;
10+ cin>>hours>>minutes>>seconds;
11+ }
12+ void showtime ()
13+ {
14+ cout<<" hours is " <<hours<<endl<<" minutes are " <<minutes<<endl<<" Seconds are " <<seconds;
15+ }
16+ void sum (time,time);
17+ };
18+ void time::sum (time t1,time t2)
19+ {
20+ minutes=t1.minutes +t2.minutes ;
21+ hours=minutes/60 ;
22+ minutes=minutes%60 ;
23+ seconds=t1.seconds +t2.seconds ;
24+ }
25+ int main ()
26+ {
27+ time t1;
28+ t1.gettime ();
29+ t1.showtime ();
30+ time t2;
31+ t2.gettime ();
32+ t2.showtime ();
33+ time t3;
34+ t3.sum (t1,t2);
35+ t3.showtime ();
36+ return 0 ;
37+ }
Original file line number Diff line number Diff line change 1+ #include < iostream>
2+ using namespace std ;
3+ class Nish
4+ {
5+ int sapid=500060720 ;
6+ string roll=" R171217041" ;
7+ string name=" Nishkarsh Raj Khare" ;
8+ void show ()
9+ {
10+ cout<<" The sapid is " <<sapid<<endl<<" Roll number is " <<roll<<endl;
11+ }
12+ public:
13+ void nothing ();
14+ void display ()
15+ {
16+ cout<<" This is a public function maen" <<endl;
17+ show ();
18+ }
19+ };
20+ void Nish:: nothing()
21+ {
22+ cout<<" Resolution baybeeee" <<endl;
23+ }
24+ int main ()
25+ {
26+ Nish n;
27+ n.display ();
28+ n.nothing ();
29+ cout<<endl;
30+ return 0 ;
31+ }
32+
Original file line number Diff line number Diff line change 1+ #include < iostream>
2+ using namespace std ;
3+ int main ()
4+ {
5+ cout<<" Hello World" ;
6+ return 0 ;
7+ }
Original file line number Diff line number Diff line change 1+ #include < iostream>
2+ using namespace std ;
3+ class sample
4+ {
5+ int samp;
6+
7+ public: // why??
8+ static int sam;
9+ void read ()
10+ {
11+ cout<<" Enter the values" <<endl;
12+ cin>>samp>>sam;
13+ }
14+ void sample1 ()
15+ {
16+ cout<<" Non Static" <<endl<<samp<<endl;
17+ }
18+ static void sample2 ()
19+ {
20+ cout<<" Static" <<endl<<sam<<endl;
21+ }
22+ };
23+ int sample :: sam; // why?? (2x)
24+ int main ()
25+ {
26+ cout<<" Program of static function" <<endl;
27+ sample S;
28+ S.read ();
29+ S.sample1 ();
30+ sample :: sample2 ();
31+ return 0 ;
32+ }
You can’t perform that action at this time.
0 commit comments