topshiriq quyidagi metodlarni izohlang begin


mapTarjimon={{"(3+4)*5",35},{"3*4*2",24},{"25*25",625},{"60/3",20},{"50-20-30",0}}


Download 386.89 Kb.
bet3/4
Sana28.12.2022
Hajmi386.89 Kb.
#1014358
1   2   3   4
Bog'liq
6 (Автосохраненный)

mapTarjimon={{"(3+4)*5",35},{"3*4*2",24},{"25*25",625},{"60/3",20},{"50-20-30",0}};
for(auto it=Tarjimon.begin(); it!=Tarjimon.end();it++){
cout<< it->first<<"=";cin>>a;
if(it->second==a){
cout<<"togri"<
ball=ball+2;
}
else
{
cout<<"xato"<
ball=ball-1;
}
}
cout<<"BALL:"<
return 0;}

17) Shunday dastur tuzing, kiritilgan o’nlik sonni ikkilik sanoq sistemasiga aylanitirib bersin. (Mapni o’nlik va ikkilikdagi qiymati bilan to’ldiring)
#include
#include
using namespace std;
int main(){int a;
cout<<"10lik son:";cin>>a;
mapA={{0,0},{1,1},{2,10},{3,11},{4,100},{5,101},{6,110},{7,111},{8,1000},{9,1001}};
for(auto it=A.begin(); it!=A.end();it++){
if(it->first==a)
cout<second<
}
return 0;}

18) Map hosil qiling va pifogor jadvali bilan to’ldiring. Ixtiyoriy kiritilgan n karaning jadvalini chop eting.

19) Map hosil qiling u uni n ta juftlik bilan to’ldiring. Kalit va qiymatni almashtirib, chop eting.
#include
#include
using namespace std;
int main(){int n,a;
string b;
cout<<"element son:";cin>>n;
mapA;
for(int i=1;i<=n;i++){
cout<<"kalit:";cin>>a;
cout<<"qiymat";cin>>b;
A.insert(pair(a,b));
}
for(auto it=A.begin(); it!=A.end();it++){
cout<second<first<
}
return 0;}

20) O’quvchi mapda mavjud bo’lgan inglizcha so’zni kiritsa, o’zbekcha tarjimasini, o’zbekcha kiritsa esa inglizchasini chiqaruvchi dastur tuzing.

21) Jurnaldagi o’quvchilarning ro’yxatidagi ism familyasi va tartibi bilan kirtilgan. Ixtiyoriy tartib raqam kiritilsa undan avvalgi va undan keyingi o’quvchining ism familyasini chop eting.

Download 386.89 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling