6-amaliy mashg’ulot yuzasidan topshiriqlar
Download 45.7 Kb.
|
6-amaliy
6-amaliy mashg’ulot yuzasidan topshiriqlar 1-masala
Berilish: Og'irlik birliklari quyidagi tartibda berilgan. 1-kilogramm, 2-milligramm, 3-gramm, 4-tonna, 5-sentner. Og'irlik birligini bildiruvchi soni berilgan va shu birlikdagi og'irlik qiymati berilgan. Og'irlikni kilogramda ifodalovchi programma tuzilsin. #include using namespace std; int main() {int n; float m; cout<<"Og'irlik birligini ifodalovchi son=";cin>>n; cout<<"Massa=";cin>>m; switch(n) { case 1:cout< case 3:cout< case 4:cout< case 5:cout< default: cout<<"xato raqam";
}
2-masala
#include using namespace std;
int main() {int d,m;
cout<<"Kun=";cin>>d; cout<<"Oy=";cin>>m;
if(d>0&&m>0&&m<13&&d<32) {if(m==2&&d>28)
cout<<"fevral 28 da tugaydi"; else switch(m)
{case 1:cout< case 2:cout< case 3:cout< case 4:cout< case 5:cout< case 6:cout< case 7:cout< case 8:cout< case 9:cout< case 10:cout< case 11:cout< case 12:cout< }}else cout<<"Bunday sana mavjud emas"; 3-masala
#include using namespace std;
int main() {int d,m;
cout<<"Kun=";cin>>d; cout<<"Oy=";cin>>m;
if(d>0&&m>0&&m<13&&d<32) {if(m==2&&d>28)
cout<<"fevral 28 da tugaydi"; else switch(m)
{case 1:(d==31)?cout<<"1-fevral":cout< case 2:(d==28)?cout<<"1-mart":cout< case 3:(d==31)?cout<<"1-aprel":cout< case 4:(d==31)?cout<<"1-may":cout< case 5:(d==31)?cout<<"1-iyun":cout< case 6:(d==31)?cout<<"1-iyul":cout< case 7:(d==31)?cout<<"1-avgust":cout< case 8:(d==31)?cout<<"1-sentabr":cout< case 9:(d==31)?cout<<"1-oktabr":cout< case 10:(d==31)?cout<<"1-noyabr":cout< case 11:(d==31)?cout<<"1-dekabr":cout< case 12:(d==31)?cout<<"1-yanvar":cout< }}else cout<<"Bunday sana mavjud emas"; 4-masala
#include using namespace std;
int main() {int b;char t;
cout<<"Y=";cin>>t; switch (t)
{case 's':cout<<"shimol \n";break; case 'j':cout<<"janub \n";break;
case 'q':cout<<"sharq \n";break; case 'g':cout<<"g'arb \n";break;
default:cout<<"bunday yo'nalish yo'q \n";} cout<<"K=";cin>>b;
switch(b) {case 0:cout<<" harakatni davom ettir";break;
case 1:cout<<" chapga buril";break; case 2:cout<<" o'nga buril";break;
default:cout<<"bunday buyruq yo'q";} 5-masala
#include using namespace std;
int main() {int n;float m;
cout<<"Uzunlik=";cin>>m; cout<<"Uzunlik birligini ifodalaovchi son=";cin>>n;
switch(n) {
case 1:cout< case 3:cout< case 4:cout< case 5:cout< default:cout<<"Bunday birlik kiritilmagan";
}
|
ma'muriyatiga murojaat qiling