All pastes #979888 Raw Edit

Untitled

public text v1 · immutable
·published 2008-04-10 17:25 UTC
rendered paste body
#include<iostream>
using namespace std;
struct train
{
int nomer;
double times;
char finish[20];
};
int main()
{
train account[5];
for(int i=0; i<=5; i++)
{
cout<<"Введите номер поезда: ";
cin>>account[i].nomer;
cout<<"Введите пункт назначения: ";
cin>>account[i].finish;
cout<<"Введите время отправки: ";
cin>>account[i].times;
cout<<endl;
}
char search[20];
cout<<"Введите пункт назначения поезда для поиска: ";
cin>>search;
int flag=0;
for(int i=0; i<=5; i++){
if(strcmp(search,account[i].finish)==0)
{
cout << account[i].nomer << " "<< account[i].finish<<" "<< account[i].times<<endl;
flag=1;
}
}
if (flag==0)
cout<<"Такого поезда нет. \a"<<endl;
//system("pause");
return 0;
}