Advertisement
Jgug

tickets

Dec 19th, 2012
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <string.h>
  4. #include <conio.h>
  5.  
  6. using namespace std;
  7.  
  8. void main()
  9. {
  10.     unsigned int z;
  11.     char name[64];
  12.     int a,b,c,d,e,f;
  13.     char g[64];
  14.     struct dannye{
  15.         int date;
  16.         int month;
  17.         int year;
  18.         char place[10];
  19.         int hours;
  20.         int minutes;
  21.         int freeplaces;
  22.     }mstud;
  23.  
  24.     cout<<"vvedite date, month, year"<<endl;
  25.     cin>>mstud.date;
  26.     cin>>mstud.month;
  27.     cin>>mstud.year;
  28.     cout<<"Insert time"<<endl;
  29.     cin>>mstud.hours;
  30.     cin>>mstud.minutes;
  31.     cout<<"Insert freeplaces"<<endl;
  32.     cin>>mstud.freeplaces;
  33.     cout<<"vvedite place"<<endl;
  34.     cin>>name;
  35.    
  36.     for (z=0; z<strlen(name); z++)
  37.     {
  38.         mstud.place[z] = name[z];
  39.     }
  40.     mstud.place[z] = '\0';
  41.    
  42.     cout<<"zarezerv bilet: vvedite date, month, year"<<endl;
  43.     cin>>a;
  44.     cin>>b;
  45.     cin>>c;
  46.     cout<<"Insert time"<<endl;
  47.     cin>>d;
  48.     cin>>e;
  49.     cout<<"vvedite freeplaces"<<endl;
  50.     cin>>f;
  51.     cout<<"vvedite place"<<endl;
  52.     cin>>g;
  53.  
  54.     if((mstud.date>=a) && (mstud.month==b) && (mstud.year==c) && (mstud.hours>=d) && (mstud.minutes>=e) && (mstud.freeplaces<=f) && (strcmp(mstud.place, g)==0))
  55.     {
  56.         cout<<mstud.date<<"."<<mstud.month<<"."<<mstud.year<<"."<<mstud.hours<<"."<<mstud.minutes<<endl;
  57.         cout<<mstud.place;
  58.     }
  59.     else
  60.     {
  61.         cout<<"You can't buy tickets"<<endl;
  62.     }
  63.     _getch();
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement