Private: int age; string name; public: student: age(0),name("") {} student
Download 12.83 Kb.
|
dasturlash1
2. #include #include using namespace std; class student { private: int age; string name; public: student():age(0),name("") {} student(int r, string n): age(r),name (n) {} void get() { cout<<"\ntalabaning yoshini kiriting: "; cin>>age; cout<<"talabaning ismini kiriting: "; cin>>name; } void print() { cout<<"talabaning yoshi= "< }; int main () { student *ps=new student; (*ps).get(); (*ps).print(); delete ps; } 4. #include using namespace std; bool Check(int a){ if(a>=-20 && a<=20 && a%4!=0){ return 1; } else { return 0; } } int main(){ int a,b,c,d,k=0; cin>>a>>b>>c>>d; if(Check(a)){ k++; } if(Check(b)){ k++; } if(Check(c)){ k++; } if(Check(d)){ k++; } cout<<"\n[-20,20] oraliqdagi va 4 ga karrali bo'lmagan sonlar soni: \n"< } 5.
Satr bilan ishlashlangan misol: #include using namespace std; int main() { cout<<"Satar kiriting: \n"; string A; getline(cin,A); int t=0,k=0; for(int i=0; i t=i; } } for(int i=0; i k=i; } } int m=0; for(int i=t; i m++; } } cout< } Download 12.83 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling