Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #include "Rus.h"
- #include <string.h>
- struct first
- {
- char city[15];
- char name[10];
- };
- int main(void)
- {
- int i,b,d=0;
- struct first *f;
- cout<<Rus("Введите колличество рейсов\n");
- cin>>b;
- f = new struct first[b+1];
- cout<<Rus("введите город и модель самолета:\n");
- for (i=0; i<b-1; i++)
- cin>>f[i].city>>f[i].name;
- cout<<endl;
- do
- {
- for (i=0; i<b-2; i++)
- {
- if(strcmp(f[i].city, f[i+1].city)>0)
- {
- strcpy(f[b+1].city,f[i].city);
- strcpy(f[i].city,f[i+1].city);
- strcpy(f[i+1].city,f[b+1].city);
- }
- }
- d++;
- }
- while(d<b*b);
- for (i=0; i<b-1; i++)
- cout<<f[i].city<<" "<<f[i].name<<endl;
- delete f;
- }
Advertisement
Add Comment
Please, Sign In to add comment