Needing to make a Bus Ticketing System in Visual C++ for college, having errors which I can't sort out. Any help would be appriciated. The compiler doesnt like my functions. Im being told that they are all either 'Illigal Case' or 'Illigal Break'. Heres the code;
/*************************************************/
/**** Bus Ticketing System ****/
/**** Name Edited Out ****/
/*************************************************/
#include <stdio.h>
#include <conio.h>
#include "bcio2.h"
#include <time.h>
void menu(void);//function prototype
void cash(void);//function prototype
void card(void);//function prototype
void welcome(void);//function prototype
void time(void);//function prototype
int passengers = 0;//declaring variables
int money = 0;//declaring variables
int paymentmethod;//declaring variables
int x;//innner loop counter
int y;//outter loop counter
main()
{
int stops;
for(stops = 1; stops < 12 ; stops++);
welcome();
time();
menu();
printf("This is stop number %d\n\n", stops);
printf("Select method of payment\n\n");
scanf("%d",&paymentmethod);
printf("How many travelling?\n\n");
scanf("%d", &passengers);
case 0 : menu();//function call
break;
case 1 : cash();//function call
break;
case 2: card();//function call
break;
case 3 : welcome();//function call
break;
default : printf("The number entered was not appliciable");
break;
getch();
clrscr();
return 0;
}
/*************************************************/
/**** Start Of Function Definitions ****/
/*************************************************/
void menu(void)
{
printf("1 : Cash\n\n2 : Card\n\n");
}
void cash(void)
{
printf("passengers * 75=%d\n\n",passengers * 75");
}
void card(void)
{
printf("Welcome aboard card holder\n\n");
}
void welcome(void)
{
printf("\t\t\tName Edited Out\n\t\t\tBus Ticketing System\n\n\n");
}
void time(void)
{
char dateStr [9];
char timeStr [9];
_strdate( dateStr);
printf( "The current date is %s \n", dateStr);
_strtime( timeStr );
printf( "The current time is %s \n", timeStr);
}
Help with C
Started by
Mckooy
, Jan 08 2006 01:00 PM
3 replies to this topic
#1
Posted 08 January 2006 - 01:00 PM
#2
Posted 08 January 2006 - 06:54 PM
I'm no C++ programmer, but i'm guessing your problem is you havent started the select case or ended it.
Like any selection statement it must be started then ended.
It might be something like
Select Case
xx
xx
xx
xx
End Select.
Hope this helps.
James
Like any selection statement it must be started then ended.
It might be something like
Select Case
xx
xx
xx
xx
End Select.
Hope this helps.
James
#3
Posted 08 January 2006 - 10:09 PM
switch (variable) { case 0 : menu();//function call break; case 1 : cash();//function call break; case 2: card();//function call break; case 3 : welcome();//function call break; default : printf("The number entered was not appliciable"); } getch(); clrscr(); return 0;
The
should be the same variable that u using to know which option the user select from the menu.variable
#4
Posted 11 January 2006 - 01:57 PM
looking at your code you probably need a new variable for the switch statement. I had to do a bus ticket thing for my college class a couple years ago also
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users