Advertisement
Guest User

Untitled

a guest
May 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.00 KB | None | 0 0
  1. #include"stdafx.h"
  2. #include<iostream>
  3. #include<clocale>
  4. #include<ctime>
  5. #include<string>
  6. #include<vector>
  7. #include<ctype.h>
  8. #include<stdio.h>
  9. #include<fstream>
  10. using namespace std;
  11. struct pasport
  12. {
  13.     char mark [16]; //марка
  14.     char nomba [30]; //номер
  15.     char debi [25]; //владелец
  16.     int runn; //пробег
  17. };
  18. void Writer(pasport *M,int n)
  19. {
  20.     for (int i=0;i<n;i++)
  21.     {
  22.         cout<<"------------------------------------------------------"<<endl;
  23.         cout<<"| Информация: |"<<endl;
  24.         cout<<endl;
  25.         cout<<"| марка: "<<M[i].mark<<" | \n"<<"| номер: "<<M[i].nomba<<" | \n"<<"| владелец: "<<M[i].debi<<" | \n"<<"| пробег:"<<M[i].runn<<" |"<<endl;
  26.         cout<<"------------------------------------------------------"<<endl;
  27.     }
  28. }
  29. void Family(pasport *M,int n)
  30. {
  31.  
  32.     cout<<"\n"<<"Информация о марках :"<<endl;
  33.     int t=0;
  34.     for (int i=0;i<n;i++)
  35.     {
  36.         for(int j=1;j<n;j++)
  37.         {
  38.             if (!strcmp(M[i].mark,M[i+j].mark))
  39.             {
  40.                 cout<<"------------------------------------------------------"<<endl;
  41.                 cout<<"| Информация: |"<<endl;
  42.                 cout<<endl;
  43.                 cout<<"| марка: "<<M[i].mark<<" | \n"<<"| номер: "<<M[i].nomba<<" | \n"<<"| владелец: "<<M[i].debi<<" | \n"<<"| пробег:"<<M[i].runn<<" |"<<endl;
  44.                 cout<<"------------------------------------------------------"<<endl;
  45.                 cout<<"| Информация: |"<<endl;
  46.                 cout<<endl;
  47.                 cout<<"| марка: "<<M[i].mark<<" | \n"<<"| номер: "<<M[i].nomba<<" | \n"<<"| владелец: "<<M[i].debi<<" | \n"<<"| пробег:"<<M[i].runn<<" |"<<endl;
  48.                 cout<<"------------------------------------------------------"<<endl;
  49.                 t=1;
  50.             }
  51.         }
  52.     }
  53.     if (t!=1)
  54.         cout<<"не найденно"<<endl;
  55. }
  56. void Familyy(pasport *M,int n)
  57. {
  58.  
  59.     cout<<"\n"<<"Информация о владельцах :"<<endl;
  60.     int t=0;
  61.     for (int i=0;i<n;i++)
  62.     {
  63.         for(int j=1;j<n;j++)
  64.         {
  65.             if (!strcmp(M[i].mark,M[i+j].mark))
  66.             {
  67.                 cout<<"------------------------------------------------------"<<endl;
  68.                 cout<<"| Информация: |"<<endl;
  69.                 cout<<endl;
  70.                 cout<<"| марка: "<<M[i].mark<<" | \n"<<"| номер: "<<M[i].nomba<<" | \n"<<"| владелец: "<<M[i].debi<<" | \n"<<"| пробег:"<<M[i].runn<<" |"<<endl;
  71.                 cout<<"------------------------------------------------------"<<endl;
  72.                 cout<<"| Информация: |"<<endl;
  73.                 cout<<endl;
  74.                 cout<<"| марка: "<<M[i].mark<<" | \n"<<"| номер: "<<M[i].nomba<<" | \n"<<"| владелец: "<<M[i].debi<<" | \n"<<"| пробег:"<<M[i].runn<<" |"<<endl;
  75.                 cout<<"------------------------------------------------------"<<endl;
  76.                 t=1;
  77.             }
  78.         }
  79.     }
  80.     if (t!=1)
  81.         cout<<"не найденно"<<endl;
  82.  
  83. }
  84. int _tmain(int argc, _TCHAR* argv[])
  85. {
  86. qq:
  87.     system("color F0");
  88.     setlocale(0,"Russian");
  89.     int n, i, z='z';
  90.     cout<<"Открыть  файл?(y/n)\n";
  91.     cin>>z;
  92.     if(z=='y')
  93.     {
  94.         //временно идут работы по написанию сканера
  95.         ofstream alla;
  96.         alla.open("allaxx.txt");
  97.         if (!alla)
  98.         {
  99.             cout << "\n Файл для вывода не может быть открыт или создан\n";
  100.             system("pause");
  101.             goto qq;
  102.         }
  103.         else
  104.         {
  105.             goto qq;
  106.         }
  107.     }
  108.     else
  109.     {
  110.         cout<<"Введите число машин,данные о которых хотите ввести\n"<<"N= ";
  111.         cin>>n;
  112.         system("pause");
  113.         pasport *M =new pasport[n];
  114.         system("pause");
  115.         ofstream alla;
  116.         alla.open("alla.txt");
  117.         if (!alla)
  118.         {
  119.             cout << "\n Файл для вывода не может быть открыт или создан\n\n";
  120.             system("pause");
  121.             goto qq;
  122.         }
  123.         else
  124.         {
  125.        
  126.             cout<<"Введите информацию о машине "<<endl;
  127.             for (int i=0;i<n;i++)
  128.             {
  129.                 alla<<"----------"<<i<<"\n";
  130.                 cout<<"марка: ";  
  131.                 cin>>M[i].mark;
  132.                 alla<<M[i].mark<<"\n";
  133.                 cout<<"номер: ";
  134.                 cin>>M[i].nomba;
  135.                 alla<<M[i].nomba<<"\n";
  136.                 cout<<"владелец: ";
  137.                 cin>>M[i].debi;
  138.                 alla<<M[i].debi<<"\n";
  139.                 cout<<"пробег: ";
  140.                 cin>>M[i].runn;
  141.                 alla<<M[i].runn<<"\n";
  142.                 alla<<"----------"<<i<<"\n";
  143.             }
  144.            
  145.         }
  146.  
  147.     }
  148. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement