Lutfullayev Avazbek Dasturlash 1 variant 8
tarix 15.12.2022 ölçüsü 162,77 Kb. #75091
Dasturlash dedline 2
Lutfullayev Avazbek Dasturlash 1 variant 8
Guruxdagi o’quvchilarning familiyasi, ismi, tug’ilgan yili va oyi, sanasi xaqida ma’lumot berilgan. Bahorda tug’ilgan o’quvchilar ro’yxatini chop etuvchi dastur tuzing.
#include
#include
#include
using namespace std;
struct student {
string familya;
string ism;
int birthYear;
int birthMonth;
};
void display(struct student student_record[4])
{
int i, len = 5;
for (i = 0; i < len; i++) {
if(student_record[i].birthMonth >=3 && student_record[i].birthMonth<=5){
cout<<"Familya : \t"< cout<<" Ismi : \t"<< student_record[i].ism;
cout<<"Tug'ulgan Yili : \t"< cout<<"\n";
cout<<"Tug'ulgan oyi :\t"< }
}
}
int main()
{
struct student student_record[4]
= { { "Urolaliyev","Jamshid",2003,11 },
{ "Esanov","Jamshid",2002,5 },
{ "Niyozov","Maruf",2004,4 },
{ "Vafoyev","Gayrat",2003,3 } };
cout<<"Bahorda tug'ulgan talabalar \n";
display(student_record);
cout<<"\n";
}
2
String turidagi A satrda nechta bir xil soʻz borligini aniqlovchi dastur tuzing.
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include
#include
using namespace std;
int main()
{
string str;
cout<<"Mattnini kiriting \n";
getline(cin,str);
string a[100];
int n = 0,k = 0;
for(int i = 0;i if(str[i] == ' '){
string soz;
for(int j = n;j soz = soz + str[j];
}
a[k]= soz;
k++;
n = i-1;
}
}
int count=0;
for(int i = 0,j =k;i {
if(a[i] == a[j] ){
cout< count++;
}
if(i == j){
break;
}
}
cout<<"Bir xil so'zlar soni "< }
Berilgan nomdagi matnli faylni yaratish va unga matn kiritish dasturini tuzing. Matndan eng qisqa so’zni toping.
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include
#include
#include
using namespace std;
int main()
{
string str,str2;
cout<<"Faylga nom kiriting \n";
getline(cin,str2);
ofstream file("text.txt");
cout<<"Mattnini kiriting \n";
getline(cin,str);
file< string a[100];
int b[100];
int n = 0,k = 0;
for(int i = 0;i if(str[i] == ' '){
string soz;
for(int j = n;j soz = soz + str[j];
}
a[k]= soz;
k++;
n = i+1;
}
}
int count=0,min = a[0].length();
string s;
for(int i = 0;i {
cout< if(min>a[i].length()){
cout< s = a[i];
min = a[i].length();
}
}
cout<<"Eng kichik so'z "< }
Dostları ilə paylaş: