#include <iostream.h>
#include <conio.h>
long tag[99];
float tot[99]={200};//tot=total to pay
int i=0;
#define ph 100;//ph=price per hour
char ch;
short h[99], min[99], tmins[99], st[99]={0}, eh[99], emin[99];//h=arrive hour, min=arrive minute, tmins=total minutes in parking, st=car status, eh=exit hour, emin=exit minute
void list();
void search();
void add();
void page();
void show(int);
void ex();
void main()
{
page();
}
void page()
{
clrscr();
cout<<“\t\t\t\tWelcome!”<<endl;
cout<<“\n\tPress 1 to report an arriving car”
<<“\n\tPress 2 to report an exiting car”
<<“\n\tPress 3 to see the list and search a car”<<endl;
ch=getche();
switch(ch)
{
case 49: add(); break;
case 50: ex(); break;
case 51: list(); break;
}
}
void show(int t)
{
clrscr();
cout<<“Tag\tEnter\tMins before exit\tTo pay\t\tStatus\n\n”;
cout<<tag[t]<<“\t”<<h[t]<<‘:'<<min[t]<<“\t”<<tmins[t]<<“\t\t\t”;
if(st[t]==0)
cout<<“Still in\t”;
else
cout<<tot[t]<<“\t\t”;
if(st[t]==0)
cout<<“In the parking”;
else
cout<<“Out”;
cout<<“\n\nPress any key to continue”;
getch();
page();
}
void add()
{
clrscr();
cout<<“\”Enter 0 as the tag to quit adding\”\n\n”;
for(;4;i++)
{
cout<<“Tag: “;
cin>>tag[i];
if(tag[i]==0)
{
i–;
page();
}
cout<<“Time (As this structure: H:Min): “;
cin>>h[i]>>ch>>min[i];
if(h[i]==0&&min[i]==0)
{
i–;
page();
}
if(min[i]>59)
{
cout<<“Error, Try again\n”;
i–;
continue;
}
cout<<“\n”;
}
}
void search()
{
long t;
cout<<“\nTag to search(Enter 0 to go to main page): “;
cin>>t;
if(t==0)
page();
for(int c=0;c<=i;c++)
if(tag[c]==t)
{
show(c);
break;
}
cout<<“Wasn’t found!”;
}
|
دیدگاهتان را بنویسید