Muhammad al-Xorazminomidagi T. A. T. U universiteti


Download 285.05 Kb.
Sana18.12.2022
Hajmi285.05 Kb.
#1028346
Bog'liq
6-MUSTAQIL ISHI

Muhammad al-Xorazminomidagi


T.A.T.U UNIVERSITETI
217-22-guruh talabasi
Rofiyev Olamgirningning
dasturlash fanidan bajargan
6-LABORATORIYA ishi

Tekshiruvchi:Ishniyazov Odil Olimovich

1-Jadval


  1. Misol

Berilgan nomdagi matnli faylni yaratish va unga satr kiritish dasturini tuzing. Unda ‘r’, ‘k’, ‘t’ harflari qanchaligini aniqlang.






#include


#include
#include
using namespace std;
int main()
{
string str;
int s = 0;
ofstream fout;
fout. open("myFile.txt");
if(!fout.is_open())
{
cout << "Error !" << endl;
}
else
{
cout << "Satrni kiriting: \n";
getline(cin, str);
for(int i = 0; i < str.length(); i++)
{
if(str[i] == 'r' || str[i] == 'k' || str[i] == 't')
s++;
}
cout << "\n'r', 'k', 't' - harflari " << s << " ta " << endl;
}
return 0;
}

2-Jadval


  1. Misol

input faylida berilgan natural a va b sonlarining eng kichik umumiy karralisini output fayliga yozish dasturini tuzing.

#include
using namespace std;
int main()
{
int n1, n2, max;
cout << "Enter two numbers: ";
cin >> n1 >> n2;
max = (n1 > n2) ? n1 : n2;
do
{
if (max % n1 == 0 && max % n2 == 0)
{
cout << "EKUK = " << max; break;
} else ++max;
} while (true);
return 0;
}

Download 285.05 Kb.

Do'stlaringiz bilan baham:




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