Public: string bosh punkt


Download 189.47 Kb.
Sana16.06.2023
Hajmi189.47 Kb.
#1517760
Bog'liq
dasturlash10



6)
#include
#include
using namespace std;
class marshrut
{
public:
string bosh_punkt;
string oxir_punkt;
int nomeri;
void show(void)
{
cout<<"marshrut boshi punktining nomi: "<cout<<"marshrut oxiri punktining nomi: "<cout<<"marshrut nomeri: "<cout<
}
};
int main() {
marshrut a[100];
int n;
cout<<"MArshrutlar sonini kiriting : ";
cin>>n;
for (int i=0; i cout<<"\nmarshrut boshi punktining nomi: ";
cin>>a[i].bosh_punkt;
cout<<"\nmarshrut oxiri punktining nomi: ";
cin>>a[i].oxir_punkt;
cout<<"\nmarshrut nomeri: ";
cin>>a[i].nomeri;

}

cout<<"\na) massiv marshrut nomerlarining o'sishi bo'yicha tartiblansin\n";


for (int i=0; i for (int j=i+1; j
if(a[i].nomeri>a[j].nomeri)
swap(a[i],a[j]);
}
}
for (int i=0; i cout< }
cout<cout<<"\n\n b) klaviaturadan nomeri kiritilgan marshrut haqidagi malumotlar chop etilsin: \n";


cout<<"qidirilayotgan marshrut nomeri: ";
int b;
cin>>b;
cout<for (int i=0; i if(a[i].nomeri==b){
a[i].show();
}
else cout<<"bunday marshrut yoq!!!"; break;
}
cout<<"\n\n d) boshlanashi yoki oxiri shu punkt bo'lgan marshrutlar haqidagi ma'lumotlar chop etilsin.: \n";
cout<<"qidirilayotgan marshrut bosh punkti nomi: ";
string d,c;
cin>>d;
cout<<"qidirilayotgan marshrut oxirgi punkt nomi: ";
cin>>c;
for (int i=0; i if(a[i].bosh_punkt==d||a[i].oxir_punkt==c){
a[i].show();
}
else cout<<"bunday marshurt mavjud emas!!"; break;
}
}

13)
a)


#include
using namespace std;
int removeDupWord(string str,string s[])
{
int a=0;
istringstream ss(str);
do {
string word;
ss >> word;
s[a++]=word;
} while (ss);
return a;
}
int main()
{ cout<<"Satar kiriting: \n";
string A;
getline(cin,A);
;
string a[1000];


int a_size=removeDupWord(A,a);
cout<<"\n\nBoshi va oxirgi harflari bir xil bolgan so'zlar: \n";
for(int i=0;i string s=a[i];
if(s[0]==s[s.length()-1])
cout< }
return 0;
}

b)
#include
using namespace std;

int removeDupWord(string str,string s[])


{
int a=0;
istringstream ss(str);
do {
string word;
ss >> word;
s[a++]=word;
} while (ss);
return a;
}
int main()
{ cout<<"Satar kiriting: \n";
string A;
getline(cin,A);
;
string a[1000];


int a_size=removeDupWord(A,a);
cout<<"\n\ntoq uzunlikdagi so'zlarning o'rtadagi harfini uchirish: \n";
for(int i=0;i
if(a[i].length()%2!=0){
string s="";
int k=((a[i].length())/2);
for(int j=0; j if(k!=j) s+=a[i][j];
a[i]=s;
}
}
for (int i=0; i cout< }
return 0;
}

15)
#include


using namespace std;
struct Guruh
{
char name[100];
char tug_yil[100];
};
int main () {
int n;
cout<<"Talabalar sonini: ";
cin>>n;
Guruh t[100];
cout< for (int i=0; i cout<<"\n"< cin>>t[i].name;
cout<<"\n"< cin>>t[i].tug_yil;

cout<<"_________________________________________________________________________";
}
cout<<"\nTalabalarning ism familiyalari bo'yicha tartiblash:\n";
for (int i=0; i for (int j=i+1; j string x=t[i].name,y=t[j].name;
if(int(x[0])>int(y[0]))
swap(t[i],t[j]);
else if(int(x[0])==int(y[0])&&t[i].tug_yil swap(t[i],t[j]);
}

}
for(int i=0; i cout< cout< }

return 0;
}

Download 189.47 Kb.

Do'stlaringiz bilan baham:




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