topshiriq quyidagi metodlarni izohlang begin


Download 171.2 Kb.
bet3/4
Sana18.06.2023
Hajmi171.2 Kb.
#1574281
1   2   3   4
Bog'liq
2-topshiriq. MAP (2) (2)

{"Mirsodiq",932185804},
{"Islom",979260107},
{"Axmad",934723614},
{"Afro'za",953303473},
{"Behruz",933733173},
{"Boymurod",904482824},
{"Diyorbek",990657504},
{"Abdulaziz",990837138} };
string a;
cout<<"ISM ini kiriting "; cin>>a;
for(auto it=telefon_kitobi.begin(); it!=telefon_kitobi.end(); it++)
if(a==it->first) cout<second<
}
23) Login va paroldan iborat jadval hosil qiling. Tizimga kiruvchi loginni va parolni kiritsin, agar to’g’ri bo’lsa, “ login va parol to’g’ri” aks hola “login yoki parol xato “ so’zini chop eting.
#include
#include
using namespace std;
int main()
{
mapaccount=
{{"Maxsudbek",904570708},
{"Marjona",945494436},
{"Javohir",938304405},
{"Mo'min",995768896},
{"Behruz",993327310},
{"Farrux",908923604},
{"Malohat",916912283},
{"Otabek",990712449},
{"Jahonzeb",915142379},
{"Sherbek",936625590},
{"Amanjon",907124640},
{"Dilmurod",935858397},
{"Jamol",945777269},
{"Tohir",882831503},
{"Bobur",934620704},
{"Sherozbek",932003849},
{"Mukammal",931437802},
{"Ruxshona",886840407},
{"Mirsodiq",932185804},
{"Islom",979260107},
{"Axmad",934723614},
{"Afro'za",953303473},
{"Behruz",933733173},
{"Boymurod",904482824},
{"Diyorbek",990657504},
{"Abdulaziz",990837138} };
string a; int b,k,s=0;
k=account.size();
cout<<"loginni kiriting "; cin>>a;
cout<<"parolni kiriting "; cin>>b;
for(auto it=account.begin(); it!=account.end(); it++){ s++;
if(a==it->first and b==it->second) {cout<<"login va parol to'g'ri"<
if(s==k) cout<<"login va parol xato";
}
24) Katta va kichik harflarni bir xil kodlab, ikki o’quvchi kelishgan holda, alifbodagi harflarni turgan o’rniga moslab, kodga aylantirdi. Birinchi o’quvchi uchun yozgan maktub matnini kodga aylantirib bersin. Ikkinchi o’quvchi uchun esa, yozilgan kodni matnga aylantirib beruvchi dastur tuzing.
#include
#include
#include
using namespace std; // olma==1512131

int main()


{
mapshifr=
{{'A',1},{'a',1},{'B',2},{'b',2},{'C',3},{'c',3},
{'D',4},{'d',4},{'E',5},{'e',5},{'F',6},{'f',6},
{'G',7},{'g',7},{'H',8},{'h',8},{'I',9},{'i',9},
{'J',10},{'j',10},{'K',11},{'k',11},{'L',12},{'l',12},
{'M',13},{'m',13},{'N',14},{'n',14},{'O',15},{'o',15},
{'P',16},{'p',16},{'Q',17},{'q',17},{'R',18},{'r',18},
{'S',19},{'s',19},{'T',20},{'t',20},{'U',21},{'u',21},
{'V',22},{'v',22},{'W',23},{'w',23},{'X',24},{'x',24},
{'Y',25},{'y',25},{'Z',26},{'z',26} };

string b,l; int m;


char Array[100];
cout<<"xabarni kiriting "; cin.getline(Array,100);
for(int i=0; i<=100; i++)
for( auto it=shifr.begin(); it!=shifr.end(); it++)
if(Array[i]==it->first)
cout<second<<" ";
}

#include


#include
#include
#include
using namespace std;
int main()
{
int s=0,k;
cout<<"matnli ma'lumotni kodlamoqchi bo'lsangiz 1 ni aks holda 2 ni kiriting"<cout<<"1 shifrlash"<cin>>k;
cin.ignore();
char l,a,A[10000];
map cod;
for(int i=1, a='a'; i<=26; i++,a++)
cod.insert(pair (a,i));
for(int i=27; i<=28; i++)
{
if(i==27)
cod.insert(pair ('.',i));
else
cod.insert(pair (' ',i));
}
if(k==1){
cout<<"Matnni kiriting ";
gets(A);

for(int i=0; i
{
l=tolower(A[i]); cout<} cout<else if(k==2)
{
char B[10000];
cout<gets(B);

vector C;


C.resize(1000);
for(int i=0; i<=strlen(B); i++){
if(B[i+1]==' ')
{C[s]=B[i]-48; s++; i++; }
else
{C[s]=10*(B[i]-48)+(B[i+1]-48); i+=2; s++; }
}
cout<for(int i=0; i<=C.size(); i++)
for(auto it=cod.begin(); it!=cod.end(); it++)
{ if(C[i]==it->second) cout<first; }
cout<main();
}
25) Ismlar va ularga mos telefon raqamlar kiritilgan. Eng omadli raqam va uning ismini chop eting.
#include
#include
using namespace std;
int main()
{ srand(time(NULL));
int s=0;
map
omad=
{ { " Bobur", "+998995428973"},
{ " Javohir ", "+998938304405"},
{ " Diyorbek ", " +998990756504" },
{ " Ahmad", " +998944723614" }};

p: int a=rand()%5;


if (a==0) goto p;

for( auto k=omad.begin(); k!=omad.end(); k++)


{ s++; if (s==a) cout<first<<" "<second<} }

26) Talabalarning ismi familyasi, va uning barcha fanlardan olgan baholarini kiriting. Shu talabalarning ichidan o’rtacha bahosi eng yuqori bo’lgan Talabani aniqlang.
27) Talabalar ro’yxati berilgan. Darsda mavjud talabalarning ismi kirtilgach umumiy davomat % da, jami talabalar soni, darsdan qatnashganlar, darsdan qatnashmaganlar soni chop etilsin.
28) Talabalarning ismlari kiritilgan. Darsda har bir savolga kim javob bergan bo’lsa uning ismi kiritiladi. Har bir javob uchun 1 ball beriladi. Dars so’nggida barcha talabalarning umumniy toplagan ballari chop etilsin

Download 171.2 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




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