О‘ZBEKISTON RESPUBLIKACI OLIY VA О‘RTA MAXSUSTA’LIMVAZIRLIGI
MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETINURAFSHON FILIALI
“Kompyuterinjiniringi”fakulteti
Guruhnomi _____710-21 AXo’
F.I.SH ___Boqiyev Dilshodning
bajargan
№ 3 - Laboratoriyaishi
a.Vazifa:
YANGI KONTEYNERLAR HOSIL QILING UNI STANDART FUNKSIYALAR YORDAMIDA ELEMENTLAR BILAN TOLATING COUNT FUNKSIYASI YORDAMIDA AMALLARNI BAJARING.
Bajarilishi:
#include
#include
#include
#include
#include
using namespace std;
int main()
{
string str;
cout<<"sozni kiriting:\n";
cin>>str;
int count=0;
int l=str.length();
for(int i=0; i{
if(str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u')
{
count++;
}
}
cout<<"unlilar soni="<return 0;
}
b.Vazifa
ITERATORLARDAN FOYDALANIB MAP KONTEYNERI USTIDA AMALAR BAJARING.
Bajarilishi:
#include
#include
#include
#include
mp1.insert(pair(5, 505));
mp1.insert(pair(6, 508));
mp1.insert(pair(7, 101));
// mp1 mapni ekranga chiqaramiz
map::iterator itr;
cout << "\nmp1 Map elementlari :\n ";
for (itr = mp1.begin(); itr != mp1.end(); ++itr) {
cout<<'\t'<first<<'\t'<second<<'\n'; }
// mp1 dan kalit maydoni 3 ga teng bo'lganlarni o'chiramiz
cout << "\nmp1 elementlari (o'zgargan qiymayt) :\n";
mp1.erase(mp1.begin(), mp1.find(3));
for (itr = mp1.begin(); itr != mp1.end(); ++itr) {
cout<<'\t'<< itr->first<<'\t'<second<<'\n'; }
// Kalit qiymati=4 bo'lgan barcha elementlarni o'chiramiz
int num;
num = mp1.erase(4);
cout<<"\nmp1.erase(4):"<for(itr = mp1.begin(); itr != mp1.end(); ++itr) {
cout<<'\t'<first<<'\t'<second<<'\n';}
system("Pause");
return 0;
}
C-Vazifa:
FRE ( ) FUNKSIYASIDAN FOYDALANIB XOTIRANI DINAMIK TAQSIMLASHNI BAJARING.
Bajarilishi:
#include
#include
using namespace std;
int main()
{
int *dil;
dil = (int*) malloc(5*sizeof(int));
cout << "5ta butun son kiriting" << endl;
for (int i=0; i<5; i++)
{
// *(dil+i) bilan almashtirish mumkun dil[i]
cin >> *(dil+i);
}
cout << endl << "foydalanuvchi kiritgan qiymat"<< endl;
for (int i=0; i<5; i++)
{
cout << *(dil+i) << " ";
}
free(dil);
cout << "chiqindi qiymat" << endl;
for (int i=0; i<5; i++)
{
cout << *(dil+i) << " ";
}
return 0;
}
Asosiy adabiyotlar:
Moʻminov B.B.,Dasturlash I.Oʻzbekiston Respublikasi Oliy va oʻrta maxsustaʻlim vazirligi. – T.: «NAMUNA», 2020. –311 b.
Nazirov SH.A., Qobulov R.V., Bobojanov M.R., Raxmanov Q.S. S va C++ tili. “Voris- nashriyot” MCHJ, Toshkent 2013, 488 b.
Horstmann, Cay S. C++ for everyone/Cay S. Horstmann. Printed in the United Statesof America - 2nd ed. 2010. – P. 562.
Horton I.-Beginning Visual C++ 2012/ I.Horton. Published simultaneously in Canada.–2012. –P. 988.
https://drive.google.com/file/d/1Ans7TBsQBsX_tMIYxURZcLkc_Kp7sAiX/view?usp=sharing
https://drive.google.com/file/d/1HYvMsbIsgUYGfWJj_uxxiR_S9G6G2Q-O/view?usp=sharing
Do'stlaringiz bilan baham: |