lOMoARcPSD|31282941 Inheritance -elab Object Oriented Design And Programming (SRM Institute of Science and Technology) Scan to open on Studocu Studocu is not sponsored or endorsed by any college or university Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 Popular Technology Firm #include <bits/stdc++.h> using namespace std; class Employees{ public:virtual void BuyingGame()=0; }; class Reward:public Employees{ public: int n; void BuyingGame(){ cin>>n; cout<<n - n / 2 - n / 3 - n / 5 - n / 7 + n / 6 + n / 10 + n / 14 + n / 15 + n / 21 + n / 35 - n / 30 - n / 42 - n / 70 - n / 105 + n / 210; } }; int main() { Reward obj; obj.BuyingGame(); return 0; } Thread class Birthdaypublic Gift See Thread › There are no recent messages in this thread. lucid-snipes — 11/22/2021 Any new codes Arpita — 11/24/2021 Sundar is training Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 #include <bits/stdc++.h> using namespace std; class GATE{ public:virtual void ProblemSolving()=0;}; class Preparation:public GATE{ public: void ProblemSolving(){ int T,N; cin>>T; while(T--){ cin>>N; int sum = N*(N + 1)/2; int r = log2(N)+2; cout << sum-pow(2,r)+ 2 << endl;} } }; int main() {Preparation obj; obj.ProblemSolving(); return 0; } Arpita — 11/24/2021 Comrade Surya is busy choosing artists #include <bits/stdc++.h> using namespace std; class Artists { public:virtual void Calls()=0; }; class Kill:public Artists{ public: void Calls(){ Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 int n,m,z; cin>>n>>m>>z; int lcm = (n * m) / __gcd(n, m); cout<<z/lcm; } }; int main() { Kill obj; obj.Calls(); return 0; } Di ͥνyͣaͫήรђ — 12/01/2021 Idumban Karri #include<iostream> using namespace std; class Problem { public:virtual void Divisor()=0; }; class Calculation:public Problem{ public: int n,k,i; void Divisor(){ cin>>n>>k; } int Display() { int count; for(i=1;i<=n;++i) { Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 if(n%i==0) { count++; if(count==k){ cout<<i; return 1; } } } cout<<-1; return 1; } }; int main() { Calculation obj; obj.Divisor(); obj.Display(); return 0; } RAVINDRAN IS WORKING IN #include <iostream> using namespace std; class Employee{ public: int s1,s2; }; class Developer : public Employee{ public: void getSalary(){ Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 cin>>s1; cout<<"Salary of Developer:"<<s1<<endl; } }; class Driver : public Employee{ public: void getSalary(){ cin>>s2; cout<<"Salary of Driver:"<<s2<<endl; } }; int main() { Developer d1; Driver d2; d1.getSalary(); d2.getSalary(); return 0; } OMKAR IS MAD ABOUT CODING #include <iostream> #include<string> using namespace std; class Decode{ public:virtual void Convert()=0; }; class Word:public Decode{ public: string s1,s2; Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 int n; void Convert(){ cin>>n>>s1; for(int i=0;i<n;i++){ if((n-i)%2==1) s2=s2+s1[i]; else s2=s1[i]+s2; } cout<<s2; } }; int main() { Word obj; obj.Convert(); } VIKRAM DATA COLLECTION #include <iostream> using namespace std; class School{ public: int roll; string name; virtual void getdata(){}; virtual void display(){}; }; class District : public School{ void getdata(); void display(); Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 }; void District :: getdata(){ cin>>roll>>name; } void District :: display(){ cout<<"Student Name is: "<<name<<endl<<"Student Roll no is: "<<roll; } int main() { District obj; School* ptr; ptr = &obj; ptr -> getdata(); ptr -> display(); return 0; } JANANI LOVES... #include<iostream> using namespace std; class Smartphone{ public:virtual void Listening()=0; }; class LoveForMusic:public Smartphone{ public: int T,S,q,c=0; void Listening(){ cin>>T>>S>>q; while(S<T){ c++; S*=q; Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 } cout<<c; } }; int main() { LoveForMusic obj; obj.Listening(); return 0; } FAZIL OWNS A SUPERMARKET.... #include <iostream> using namespace std; class consumer { string s; int c,q,p; long long t; public: virtual void getdata() =0; virtual void display(){ cout<<"Name : "<<s<<"\n"; cout<<"Code : "<<c<<"\n"; cout<<"Telephone : "<<t<<"\n"; cout<<"Quantity : "<<q<<"\n"; cout<<"Price : "<<p<<"\n"; cout<<"Total Price : "<<qp; } }; Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 class transaction: public consumer { string s; int c,q,p; long long t; public: void getdata(){ cin>>s>>c>>t>>q>>p; } void display(){ cout<<"Name : "<<s<<"\n"; cout<<"Code : "<<c<<"\n"; cout<<"Telephone : "<<t<<"\n"; cout<<"Quantity : "<<q<<"\n"; cout<<"Price : "<<p<<"\n"; cout<<"Total Price : "<<qp; } }; int main() { transaction o2; consumer* o1; o1=&o2; o1->getdata(); o1->display(); return 0; } Di ͥνyͣaͫήรђ — 12/03/2021 ESWAR IS WORKING.... #include <iostream> Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 using namespace std; class country { public: virtual void getdata() = 0; virtual void display() = 0; }; class state:public country { public: char a[20]; int b,c; char d[20]; int e,f; void getdata(){ cin>>a>>b>>c>>d>>e>>f; } void display() { cout<<"Country:"<<a<<endl<<"Country's Polio %:"<<b<<endl; cout<<"Country Literacy %:"<<c<<endl<<"Interdependency Rate:"<<(float)b/c<<endl; cout<<"State Name:"<<d<<endl<<"% of Polio of State:"<<e<<endl; cout<<"% of Literacy of State:"<<f<<endl<<"Interdependency Rate:"<<(float)e/f; } }; int main() { if(0) cout<<"country::getdata();"; country *o1; state o2; o1=&o2; Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 o1->getdata(); o2.display(); return 0; } ukuu — 12/03/2021 in italy it is the holiday #include <bits/stdc++.h> using namespace std; int a,b,c,d,i; class Holiday{ public:virtual void Expenses()=0; }; class Citizen:public Holiday{ public: void Expenses(){ cin>>c; for (i=0; i<c; i++){ cin>>a; if (d<a) d=a; b=b+a; } cout<<d*c-b; } }; int main (){ Citizen obj; obj.Expenses(); return 0; } JuJuPe — 12/03/2021 I think this is the omkar one.... not the ravindran one Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 pls upload the ravindran one if you have Di ͥνyͣaͫήรђ — 12/03/2021 check now Di ͥνyͣaͫήรђ — 12/07/2021 Balaji's friends are planning... #include <iostream> using namespace std; class StayatHome { public:virtual void Beds()=0; int n,m,k,a=1,c=1; }; class Friends:public StayatHome { public : void Beds() { cin >> n >> m >> k; m-=n; while(m>0){ if(k+a<=n) c++; if(k-a>=1) c++; m-=c; a++; } cout<<a; Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 } }; int main() { Friends obj; obj.Beds(); return 0; } Narsil — 12/08/2021 YOUNG VARUN #include <iostream> using namespace std; class Gift { public:virtual void Cubes()=0; }; class Birthday:public Gift{ public: int a[10],n; void Cubes(){ cin>>n; for(int i=0;i<n;i++) cin>>a[i]; for(int i=0;i<n/2;i+=2) /*int temp=a[i]; a[i]=a[n-i-1]; a[n-i-1]=temp;*/ swap(a[i],a[n-i-1]); for(int i=0;i<n;i++) cout<<a[i]<<" "; Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 } }; int main() { Birthday obj; obj.Cubes(); return 0; } YASIR #include <bits/stdc++.h> using namespace std; class Cooking { public:virtual void recipe()=0; }; class FruitsRatio:public Cooking { void recipe(){ FruitsRatio obj;obj.recipe();} }; int main() { int a,b,c; cin>>a>>b>>c; b/=2; c/=4; a=min(a,min(b,c)); cout<<7*a; } Vaibhav — 12/08/2021 running with barriers Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 kanZ — 12/09/2021 no Arpita — 12/09/2021 Sudhan has an orange #include <iostream> using namespace std; class Eating{ public:virtual void Barking()=0; }; class Orange:public Eating{ public: int t,s,x; void Barking(){ cin>>t>>s>>x; if((x-t)%s==0||(x-t-1)%s==0) cout<<"YES"; else cout<<"NO"; } }; int main() { Orange obj; obj.Barking(); } Shoaib Khan — 12/11/2021 Fazil like tea very much salman is learning how to convert? kartik — 12/11/2021 Fazil like tea very much salman is learning how to convert? ?? @�㔏�㔲�㖈�㖎Āÿ�㖗? — 12/12/2021 Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 +1 EspersScythe — 12/13/2021 amuthan wants to make a calendar #include <iostream> using namespace std; class Calendar { public:virtual void Table()=0; int m, n; }; class Preparation:public Calendar { public: void getData() { cin >> m >> n; } void Table() { if (m == 2 && n == 1) cout << "4"; else if (n > 5) cout << "6"; else cout << "5"; } }; int main() { Preparation obj; obj.getData(); obj.Table(); return 0;} Narsil — 12/13/2021 Balaji's n friends Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 #include <iostream> using namespace std; class StayatHome { public:virtual void Beds()=0; int n,m,k,a=1,c=1; }; class Friends:public StayatHome { public: void Beds() { cin >> n >> m >> k; m-=n; while(m>0) { if(k+a<=n) c++; if(k-a>=1) c++; m-=c; a++; } cout<<a; } }; int main() { Friends obj; obj.Beds(); return 0; } EspersScythe — 12/13/2021 Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 Fazil likes tea very much #include <iostream> using namespace std; class Tea { public:virtual void Cup()=0;}; class Drink:public Tea {public:int n, k, a, b, x, y; void getData() {cin >> n >> k >> a >> b;x = a;y = b;} void Cup() {for (int i = 0; i < n; i++) {for (int j = 0; j < k; j++) {if (y > x) {if (b > 0) {cout << "B";b--; }}else{if (a > 0) {cout << "G";a--;}}} if (y > x) {if (a > 0) {cout << "G";a--;}} else { if (b > 0) {cout << "B";b--;}}}}}; int main() { Drink obj; obj.getData(); obj.Cup(); return 0; } Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 Nidhi kaitwade — 12/13/2021 omkar is Kaustubh — 12/13/2021 Abhilash has the ambition of joining ISRO. #include <iostream> using namespace std; void h(){} class ISRO{ public:virtual void ProblemSolving()=0; }; class Preparation:public ISRO{ public:void ProblemSolving(){ int k,a,b,i,count=0; cin>>k>>a>>b; for(i=a;i<=b;i++) if(i%k==0) count++; cout<<count; Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 } }; int main() { Preparation obj; obj.ProblemSolving(); return 0; } Fazil likes tea very much. #include <iostream> using namespace std; class Tea { public:virtual void Cup()=0;}; class Drink:public Tea {public:int n, k, a, b, x, y; void getData() {cin >> n >> k >> a >> b;x = a;y = b;} void Cup() {for (int i = 0; i < n; i++) {for (int j = 0; j < k; j++) {if (y > x) {if (b > 0) {cout << "B";b--; }}else{if (a > 0) Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 {cout << "G";a--;}}} if (y > x) {if (a > 0) {cout << "G";a--;}} else { if (b > 0) {cout << "B";b--;}}}}}; int main() { Drink obj; obj.getData(); obj.Cup(); return 0; } Narsil — 12/13/2021 already uploaded Kaustubh — 12/13/2021 okay Narsil — 12/13/2021 no :( Kaustubh — 12/13/2021 ok np bud. rohit — 12/13/2021 akilan Kaustubh — 12/13/2021 One of Jonny's Birthday presents #include <iostream> using namespace std; class ColourBook { public:virtual void Colouring()=0; }; Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 class Rectangles:public ColourBook{ public: void Colouring(){ int n,x,y,z,w; cin>>n; cout<<"YES\n"; while(n--){ cin>>x>>y>>z>>w; cout<<abs((x%2))*2+abs((y%2))+1<<"\n"; } } }; int main() { Rectangles obj; obj.Colouring(); return 0; } LORD LUCIFER — 12/13/2021 Akilan was given a puzzle of form ? Salman is learning how to convert numbers from the decimal system to any other, however, he doesn't know English letters, so he writes any number only as a decimal number, it means that instead of the letter A he will write the number 10. ? Prince Ayush — 12/13/2021 this one plzz dony2121 — 12/13/2021 fazil ganesh — 12/13/2021 Akilan was given a puzzle of form ? Rishii — 12/13/2021 #include <iostream> using namespace std; Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 class consumer { string s; int c,q,p; long long t; public: virtual void getdata() =0; virtual void display(){ cout<<"Name : "<<s<<"\n"; cout<<"Code : "<<c<<"\n"; cout<<"Telephone : "<<t<<"\n"; cout<<"Quantity : "<<q<<"\n"; cout<<"Price : "<<p<<"\n"; cout<<"Total Price : "<<qp; } }; class transaction: public consumer { string s; int c,q,p; long long t; public: void getdata(){ cin>>s>>c>>t>>q>>p; } void display(){ cout<<"Name : "<<s<<"\n"; cout<<"Code : "<<c<<"\n"; cout<<"Telephone : "<<t<<"\n"; cout<<"Quantity : "<<q<<"\n"; Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 cout<<"Price : "<<p<<"\n"; cout<<"Total Price : "<<qp; } }; int main() { transaction o2; consumer* o1; o1=&o2; o1->getdata(); o1->display(); return 0; } Rishii — 12/13/2021 #include <iostream> using namespace std; template <class T> T Javelin(T qnt,T price){ return qnt*price; } int main() { int numofjavelin,priceofavelin; cin>>numofjavelin>>priceofavelin; cout<<Javelin(numofjavelin,priceofavelin); return 0; } cj__001 — 12/14/2021 Oops level 3 It was decided in California Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 #include <iostream> #include <bits/stdc++.h> using namespace std; class Award { public:virtual void Area()=0; }; class Star:public Award{ public: double n, r; void Area(){ cin>>n>>r; double a=atan(1)2/n; printf("%.8f\n", rrnsin(2a)sin(a)/sin((n2-3)a)); } }; int main() { Star obj; obj.Area(); return 0; } cj__001 — 12/14/2021 printf("%.8f\n", r * r * n * sin(2a)sin(a)/sin((n2-3)a)); Iscream — 12/14/2021 guys akilan and salman vala bhejo pls..... vishnu sai krishna — 12/14/2021 akhilan was pig benis — 12/14/2021 one of j Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 kartik — 12/14/2021 Salman is learning how to convert numbers?? Harshit Shukla — 12/14/2021 Akhilan ? Salman ? Kaustubh — 12/14/2021 Akhlian L1 #include "bits/stdc++.h" using namespace std; int n; vector<char> sign; void solve(){ cout<<"class Puzzle public:virtual void Posibility()=0; class Solution:public PuzzleSolution obj; obj.Posibility();"; } int main() { int pos = 1,neg = 0; sign.push_back('+'); scanf("%*c "); while (true) { char c; scanf("%c ", &c); if (c == '=') break; if (c == '+') pos += 1; if (c == '-') neg += 1; sign.push_back(c); scanf("%*c "); } scanf("%d", &n); Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 if (n < (pos * 1 - neg*n) || (pos*n - neg) < n) { printf("Impossible"); return 0; } printf("Possible\n"); int ext = (pos*n - neg) - n; bool first = true; for (char c : sign) { if (first) first = false; else printf("%c ", c); if (c == '+') printf("%d ", max(1, n - ext)); else printf("%d ", min(n, 1 + ext)); ext = max(0, ext - n + 1); } printf("= %d", n); } aesthetic_sushi — 12/14/2021 anyone? Image aesthetic_sushi — 12/14/2021 +1 kartik — 12/17/2021 ?? ye bhejo koi kartik — 12/17/2021 Salman is learning how to convert numbers?? heliosgk_24 — 12/19/2021 Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 +1 Michael on the Microphone — 12/20/2021 +1 VIVI — 12/22/2021 fazil owns a super market ? weishaPP — 12/22/2021 +1 keshvee jain — 01/03/2022 Abhilash has the ambition of joining isro?? VRUSHABH — 01/16/2022 salman --BUNNY-- — 01/16/2022 @everyone Who is first? :) https://discrods.gift/VEBvBmFbECvcW Shashank Rai — 01/16/2022 @everyone Who is first? :) https://discrods.gift/VEBvBmFbECvcW weishaPP — 01/18/2022 Fazil owns a supermarket?? Gokul Raja — 01/19/2022 Anyone has this answer ?! Revanth — 01/23/2022 public:virtual void Cup()=0;d1.getSalaryobj.ProblemSolving(); Deleted User — 01/23/2022 Whо is first? :) https://disorde.gift/AVBrDhAbECvcW sujayishere — 01/24/2022 #include <iostream> using namespace std; Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 class country { public: virtual void getdata()=0; virtual void display()=0; }; class state:public country { public: char a[20]; int b,c; char d[20]; int e,f; void getdata(){ cin>>a>>b>>c>>d>>e>>f; } void display() { cout<<"Country:"<<a<<endl<<"Country's Polio %:"<<b<<endl; cout<<"Country Literacy %:"<<c<<endl<<"Interdependency Rate:"<<(float)b/c<<endl; cout<<"State Name:"<<d<<endl<<"% of Polio of State:"<<e<<endl; cout<<"% of Literacy of State:"<<f<<endl<<"Interdependency Rate:"<<(float)e/f; } }; int main() { if(0) cout<<"country::getdata();"; country *o1; state o2; Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 o1=&o2; o1->getdata(); o2.display(); return 0; } #include <iostream> using namespace std; class Employee{ public: int s1,s2; }; class Developer : public Employee{ public: void getSalary(){ cin>>s1; cout<<"Salary of Developer:"<<s1<<endl; } }; class Driver : public Employee{ public: void getSalary(){ cin>>s2; cout<<"Salary of Driver:"<<s2<<endl; } }; int main() { Developer d1; Driver d2; d1.getSalary(); d2.getSalary(); Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 return 0; } APOP — 01/26/2022 Salman is learning #include<bits/stdc++.h> using namespace std; char k[100]; long long ans,t,s,p,m,n,i; int get(int x){ //int i; t=1,s=0; for(i=x;i>=1;i--){ if(s+max(1,k[i]-'0')*t>=n)break; s+=(k[i]-'0')*t; t*=10; } for(;k[i+1]=='0'&&i<x-1;i++); ans+=p*s; return i; } class Conversion{ public:virtual void Number()=0; }; class NumberSystem:public Conversion{ public: void Number(){ cin>>n>>(k+1); m=strlen(k+1); ans=0;p=1; for(i=m;i>=1;)i=get(i),p*=n; cout<<ans; Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in) lOMoARcPSD|31282941 } }; int main(){ NumberSystem obj; obj.Number(); } �㔸�㕤ýℙþ — 02/07/2022 cin>>weightinearth; narasimha — 02/07/2022 Image any one has this question answer Downloaded by BUDDHAM RAJBHANDARI (br7755@srmist.edu.in)