Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <locale.h>
- #include <windows.h>
- #include <string>
- using namespace std;
- int main (void)
- {
- setlocale(LC_ALL,"rus");
- char buff[10]; char name[150]; char reg[10]; string bb; string rr; int fnd;
- NEXT:
- ifstream fin("C:\\Users\\Андрюша\\Documents\\region.txt");
- if (!fin.is_open())
- cout << "Файл не найден!\n";
- cout<<"Введите номер региона "; cin>>reg; rr=reg;
- if (rr=="00") { cout<<"Выход из программы"<<endl;
- fin.close();
- return 0;}
- while(!fin.eof())
- {
- fnd=0;
- fin >> buff; fin.getline(name,100,'\n'); bb= buff;
- if (bb==rr) { cout<<"Регион № "<< bb << " называется "<< name <<endl; fnd=1; break; }
- }
- if (fnd==0) { cout<<"Регион не найден"<<endl; }
- else fnd=0;
- strcpy(buff,""); strcpy(name,""); strcpy(reg,""); bb=""; rr="";
- fin.close();
- goto NEXT;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement