#include<iostream>
#include<Windows.h>
using namespace std;
struct info
{
string type;
string model;
int vNo;
}s;
void menu();
void car();
void bus();
void motorcycle();
int main()
{
int n;
cout << " ================================
";
cout << " |Welcome to parking charge system|
";
cout << " ================================
";
do
{
menu();
int choice;
cout << "
enter choice: ";
cin >> choice;
cout << " ----------------------------------
";
switch (choice)
{
case 1:
car();
break;
case 2:
bus();
break;
case 3:
motorcycle();
break;
default:
cout << " please, choose from menu.
";
break;
}
cout << "
press...-1 to end program: ";
cin >> n;
} while (n != -1);
return 0;
}
//menu
void menu()
{
cout << " ----------------------------------
";
cout << " press..1 to enter car.
";
cout << " press..2 to enter bus.
";
cout << " press..3 to enter motorcycle.
";
cout << " ----------------------------------
";
}
//car
void car()
{
system("cls");
cout << " enter type of car: ";
cin >> s.type;
cout << " enter model of car: ";
cin >> s.model;
cout << " enter V_NO of car: ";
cin >> s.vNo;
cout << " ";
for (int i = 0; i < 10; i++)
{
cout << ".";
Sleep(1000);
}
cout << "
car is added
";
cout << " ----------------------------------
";
cout << " |Ticket:
";
cout << " |
";
cout << " |car type: " << s.type << "
";
cout << " |car model: " << s.model << "
";
cout << " |car v_no: " << s.vNo << "
";
cout << " |
";
cout << " |price: 20 $
";
cout << " ----------------------------------
";
}
//bus
void bus()
{
system("cls");
cout << " enter type of bus: ";
cin >> s.type;
cout << " enter model of bus: ";
cin >> s.model;
cout << " enter V_NO of bus: ";
cin >> s.vNo;
cout << " ";
for (int i = 0; i < 10; i++)
{
cout << ".";
Sleep(1000);
}
cout << "
bus is added
";
cout << " ----------------------------------
";
cout << " |Ticket:
";
cout << " |
";
cout << " |bus type: " << s.type << "
";
cout << " |bus model: " << s.model << "
";
cout << " |bus v_no: " << s.vNo << "
";
cout << " |
";
cout << " |price: 40 $
";
cout << " ----------------------------------
";
}
//motorcycle
void motorcycle()
{
system("cls");
cout << " enter type of motorcycle: ";
cin >> s.type;
cout << " enter model of motorcycle: ";
cin >> s.model;
cout << " enter V_NO of motorcycle: ";
cin >> s.vNo;
cout << " ";
for (int i = 0; i < 10; i++)
{
cout << ".";
Sleep(1000);
}
cout << "
motorcycle is added
";
cout << " ----------------------------------
";
cout << " |Ticket:
";
cout << " |
";
cout << " |motorcycle type: " << s.type << "
";
cout << " |motorcycle model: " << s.model << "
";
cout << " |motorcycle v_no: " << s.vNo << "
";
cout << " |
";
cout << " |price: 10 $
";
cout << " ----------------------------------
";
}