Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include"stdafx.h"
- #include<iostream>
- #include<clocale>
- #include<ctime>
- #include<string>
- #include<vector>
- #include<ctype.h>
- #include<stdio.h>
- #include<fstream>
- using namespace std;
- struct pasport
- {
- char mark [16]; //марка
- char nomba [30]; //номер
- char debi [25]; //владелец
- int runn; //пробег
- };
- void Writer(pasport *M,int n)
- {
- for (int i=0;i<n;i++)
- {
- cout<<"------------------------------------------------------"<<endl;
- cout<<"| Информация: |"<<endl;
- cout<<endl;
- cout<<"| марка: "<<M[i].mark<<" | \n"<<"| номер: "<<M[i].nomba<<" | \n"<<"| владелец: "<<M[i].debi<<" | \n"<<"| пробег:"<<M[i].runn<<" |"<<endl;
- cout<<"------------------------------------------------------"<<endl;
- }
- }
- void Family(pasport *M,int n)
- {
- cout<<"\n"<<"Информация о марках :"<<endl;
- int t=0;
- for (int i=0;i<n;i++)
- {
- for(int j=1;j<n;j++)
- {
- if (!strcmp(M[i].mark,M[i+j].mark))
- {
- cout<<"------------------------------------------------------"<<endl;
- cout<<"| Информация: |"<<endl;
- cout<<endl;
- cout<<"| марка: "<<M[i].mark<<" | \n"<<"| номер: "<<M[i].nomba<<" | \n"<<"| владелец: "<<M[i].debi<<" | \n"<<"| пробег:"<<M[i].runn<<" |"<<endl;
- cout<<"------------------------------------------------------"<<endl;
- cout<<"| Информация: |"<<endl;
- cout<<endl;
- cout<<"| марка: "<<M[i].mark<<" | \n"<<"| номер: "<<M[i].nomba<<" | \n"<<"| владелец: "<<M[i].debi<<" | \n"<<"| пробег:"<<M[i].runn<<" |"<<endl;
- cout<<"------------------------------------------------------"<<endl;
- t=1;
- }
- }
- }
- if (t!=1)
- cout<<"не найденно"<<endl;
- }
- void Familyy(pasport *M,int n)
- {
- cout<<"\n"<<"Информация о владельцах :"<<endl;
- int t=0;
- for (int i=0;i<n;i++)
- {
- for(int j=1;j<n;j++)
- {
- if (!strcmp(M[i].mark,M[i+j].mark))
- {
- cout<<"------------------------------------------------------"<<endl;
- cout<<"| Информация: |"<<endl;
- cout<<endl;
- cout<<"| марка: "<<M[i].mark<<" | \n"<<"| номер: "<<M[i].nomba<<" | \n"<<"| владелец: "<<M[i].debi<<" | \n"<<"| пробег:"<<M[i].runn<<" |"<<endl;
- cout<<"------------------------------------------------------"<<endl;
- cout<<"| Информация: |"<<endl;
- cout<<endl;
- cout<<"| марка: "<<M[i].mark<<" | \n"<<"| номер: "<<M[i].nomba<<" | \n"<<"| владелец: "<<M[i].debi<<" | \n"<<"| пробег:"<<M[i].runn<<" |"<<endl;
- cout<<"------------------------------------------------------"<<endl;
- t=1;
- }
- }
- }
- if (t!=1)
- cout<<"не найденно"<<endl;
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- qq:
- system("color F0");
- setlocale(0,"Russian");
- int n, i, z='z';
- cout<<"Открыть файл?(y/n)\n";
- cin>>z;
- if(z=='y')
- {
- //временно идут работы по написанию сканера
- ofstream alla;
- alla.open("allaxx.txt");
- if (!alla)
- {
- cout << "\n Файл для вывода не может быть открыт или создан\n";
- system("pause");
- goto qq;
- }
- else
- {
- goto qq;
- }
- }
- else
- {
- cout<<"Введите число машин,данные о которых хотите ввести\n"<<"N= ";
- cin>>n;
- system("pause");
- pasport *M =new pasport[n];
- system("pause");
- ofstream alla;
- alla.open("alla.txt");
- if (!alla)
- {
- cout << "\n Файл для вывода не может быть открыт или создан\n\n";
- system("pause");
- goto qq;
- }
- else
- {
- cout<<"Введите информацию о машине "<<endl;
- for (int i=0;i<n;i++)
- {
- alla<<"----------"<<i<<"\n";
- cout<<"марка: ";
- cin>>M[i].mark;
- alla<<M[i].mark<<"\n";
- cout<<"номер: ";
- cin>>M[i].nomba;
- alla<<M[i].nomba<<"\n";
- cout<<"владелец: ";
- cin>>M[i].debi;
- alla<<M[i].debi<<"\n";
- cout<<"пробег: ";
- cin>>M[i].runn;
- alla<<M[i].runn<<"\n";
- alla<<"----------"<<i<<"\n";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement