JalilovaDildoraning “Dasturlash ii” fanidan mavzu: Onlayn navbat dasturini yaratish


Foydalanilgan adabiyotlar ro‘yxati


Download 1.11 Mb.
bet6/6
Sana18.06.2023
Hajmi1.11 Mb.
#1569092
1   2   3   4   5   6
Bog'liq
Dildora2

Foydalanilgan adabiyotlar ro‘yxati

1.https://staff.tiiame.uz/storage/users/114/presentations/Q54MdRR pBYgVDtNIWAcS96OTmBHhgVv8qKDHXVza.pdf


2.https://bumotors.ru/uz/programmirovanie-rabota-s-tekstovymi- failami-rabota-s.html


3.https://bumotors.ru/uz/programmirovanie-rabota-s-tekstovymi-failami-rabota-s.html


4.https://www.google.com/search?q=2.1.Dastur+qismlarining+ishlash+prinsplari+13&rlz=1C1GCEA_enUZ1048UZ1048&oq=2.1.Dastur+qismlarining+ishlash+prinsplari%0913&aqs=chrome..69i57j33i160l3.821j0j4&sourceid=chrome&ie=UTF-8


5.https://staff.tiiame.uz/storage/users/388/books/rysEFUa5vw4ERMNqCd0AT14b0Bbab7qn6nZIskLE.pdf


6. https://lib.fbtuit.uz/assets/files/sdasturlash_tilini_organish.pdf


7. https://library.samdu.uz/download/23603


8. https://lib.fbtuit.uz/assets/files/sdasturlash_tilini_organish.pdf


Dastur kodi


#include


#include
#include

using namespace std;


bool hammasi_qidirish(int qaysi) {


ifstream fin;

fin.open("TTJ.txt");


if (!fin.is_open())


cout << "\n x| Fayl ochilishida xatolik bor! |x";
else
{
switch (qaysi) {
case 2:
{
cout << "______________________________";
cout << "\n* * * Talabalar Ro‘yxati * * *\n";
string satr;
while (!fin.eof()) {
satr = "";
getline(fin, satr);
cout << " " << satr << endl;
}
} break;
case 3:
{
qidirish:
bool top = 0; // Topilgan yoki yoqligini aniqlash uchun
string kim; // izlanadigan ma’lumot

int qanday; // fam/ism yoki xona bo‘yichaligini aniqlash uchun


cout << "\n* * * Qanday usulda qidirmoqchisiz * * *\n";
cout << " * * 1. Familiya bilan izlash * *\n";
cout << " * * 2. Ism bilan izlash * *\n";
cout << " * * 3. Xona bilan izlash * *\n";
cout << " < < < < 4. Ortga qaytish > > > >\n";

cout << "\n >>> ";


cin >> qanday;

switch (qanday) {


case 1: { // Familiyadan har bir so‘zni tekshirib ko‘rib izlash
cout << "> Familiya kiriting > ";
cin >> kim;

string soz; // fayl dan soz o‘qish uchun


int sanoq = 0;
while (!fin.eof()) {
sanoq++;
fin >> soz;
if (soz == kim)
{
top = 1;
getline(fin, soz); // qator ni olish
cout << " _________________________________";
cout << "\n >| TOPILDI : " << kim << " " << soz;
cout << "\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n";
}
}
} break;

case 2: // ismdan


case 3: { // xona raqamidan massivlarga ajratib izlash
string fam[1000];
string ismlar[1000];
int xonalar[1000];

string soz; // fayl dan soz ajratib olish uchun


int sanoq = 0; // sozlarni sanash uchun
int x = 0, y = 0, z = 0; // massivlarning indekslari
while (!fin.eof()) {
soz = "";
fin >> soz;

if (sanoq % 3 == 0)


{
fam[x] = soz;
x++;
}
else if (sanoq % 3 == 1)
{
ismlar[y] = soz;
y++;
}
else if (sanoq % 3 == 2)
{
xonalar[z] = stoi(soz); // text dagi string ni int ga o‘tqazadi
z++;
}
sanoq++;
}

if (qanday == 2)


{
cout << "> > Ism kiriting > > ";
cin >> kim;
for (int i = 0; i < 1000; i++) // massivni aylantirib beradi
if (ismlar[i] == kim) { // ismlar massivi bilan solishtirish
top = 1;
cout << " _________________________________";
cout << "\n >| TOPILDI : ";
cout << fam[i] << " " << ismlar[i] << " " << xonalar[i] << endl;
cout << " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n";
}
}
else
{
cout << "> > Xona raqamini kiriting > > ";
int xona;
cin >> xona;
for (int i = 0; i < 1000; i++) // massivni aylantirib beradi
if (xonalar[i] == xona) { // xonalar massivi bilan solishtirish
top = 1;
cout << " _________________________________";
cout << "\n >| TOPILDI : ";
cout << fam[i] << " " << ismlar[i] << " " << xonalar[i] << endl;
cout << " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n";
}
}
} break;

case 4: {


fin.close(); // faylni yopish
return 0; // funksiyani yopish
} break;

default: {


cout << "\n x x x x| Xatolik |x x x x\n";
cout << "| Qaytadan urinib ko‘ring |\n";
goto qidirish;
}

}
if (top == 1) // qidirilayotgan odam topilganini tekshirish


hammasi_qidirish(3);
else
{
cout << "\n < < <| " << kim << " TOPILMADI |> > >\n";
hammasi_qidirish(3);
}

} break;
}


}
fin.close();
return 0;
}

void kiritish() {


ofstream ttj;


ttj.open("TTJ.txt", ofstream::app);


if (!ttj.is_open())


cout << "\n x| Fayl ochilishida xatolik bor! |x";
else {
cout << "\n > > Familiyasi > > ";
string ism, fam;
cin >> fam;
cout << " > > Ismi > > ";
cin >> ism;

ttj << endl << fam << " " << ism << " ";


cout << " > > Talabaning xonasini kiriting > > ";


int xona;
cin >> xona;

ttj << xona;


cout << "+ + + | Talaba muvaffaqqiyatli qo‘shildi | + + +\n";


}
ttj.close();
}
int main()
{
Boshlanishi:

cout << "\n\n____________________________\n";


cout << "***** Imkoniyatlarimiz *****\n\n";
cout << "**** 1. Talaba qo‘shish ****\n";
cout << "** 2. Hammasini ko‘rish ***\n";
cout << "** 3. Talabani qidirish ***\n";
cout << "< < < 4. Chiqish > > >\n";
cout << "^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n";

cout << " > > Tanlov raqamini kiriting > > ";


int tanlov;
cin >> tanlov;

switch (tanlov) {


case 1: {
kiritish();
} break;

case 2: {


hammasi_qidirish(2);
} break;
case 3: {
hammasi_qidirish(3);
} break;
case 4: {
cout << "\n - - - Dastur yopildi - - - \n";
return 0;
} break;

default: {


cout << "\n x x x x| Xatolik |x x x x\n";
cout << "| Qaytadan urinib ko‘ring |\n";
}
}
goto Boshlanishi;
return 0;
}


Download 1.11 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6




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