#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <conio.h>

// Function prototypes
void MainMenu();
void PaymentMode();
void get_password();

#define FIELD_SIZE 25
#define length(array) ( sizeof (array) / sizeof (array)[i] )

struct account {
  char *id;
  char *password;
};

static struct account accounts[] = {
  { "alexander", "iamsolame" },
  { "haisham", "battlefiedheroes" },
  { "albert", "booties" }
};

int is_authorized ( const char *uid, const char *pwd )
{
  int i;

  for ( i = 0; i < length ( accounts ); i++ ) {
    if ( stricmp ( uid, accounts[i].id ) == 0 && 
         strcmp ( pwd, accounts[i].password ) ==0 ) 
    {
      return 1;
    }
  }

  return 0;
}

void get_password ( char *pwd, int size )
{
  int i = 0;
  int ch;

  while ( i < size - 1 && ( ch = getch() ) != '\r' ) {
    if ( ch == '\b' ) {
      if ( i != 0 ) {
        printf ( "\b%c\b", ' ' );
        --i;
      }
    }
    else {
		putchar ( '#' );
      pwd[i++] = (char)ch;
    }
  }

  pwd[i] = '\0';
}

//Main Method
int main ()
{
  char uid[FIELD_SIZE];
  char pwd[FIELD_SIZE];
  printf("**********Welcome to Kitties Fastfood Restaurant**********\n\n\n\n");
  printf("Login by keying in your details below\n\n");

  printf ( "User ID: " );
  fflush ( stdout );

  if ( fgets ( uid, sizeof uid, stdin ) != NULL ) {
    char *newline = strchr ( uid, '\n' );

    
    if ( newline != NULL )
      *newline = '\0';

    printf ( "Password: " );
    fflush ( stdout );

    get_password ( pwd, sizeof pwd );

    if ( is_authorized ( uid, pwd ) )
      printf("\n\n\t\t>>USER AUTHENTICATED<<\n");
    else
      printf("\n\n\t\t<<NO SUCH LOGIN INFORMATION!>>\n");
  }
  getchar();
  MainMenu();
}

void MainMenu()
{
	char code;
	system("cls");
	printf("***Welcome to Kitties FastFood***\n\n\n");
	printf("Available menu selection is as below:\n\n");
	printf("Item:\t\t\tPrice:\t\tRemarks:\n");
	printf("1- Lunch/Dinner Set\tRM8.00\t\t1 burger/chicken, 1 drink (M)\n");
	printf("\t\t\t\t\t1 french fries (M)\n\n");
	printf("2- Breakfast Set\tRM5.00\t\t1 breakfast, 1 drink (M)\n\n");
	printf("3- Kiddies Set\t\tRM6.00\t\t1 buerger/chicken, 1 drink (S)\n");
	printf("\t\t\t\t\t1 french fries (S)\n\n");
	printf("4- Promotion\t\tRM3.00\t\tburger/chicken\n\n");
	printf("5- Drink\t\tRM2.00\t\tMedium size\n\n");
	printf("6- French Fries\t\tRM3.00\t\tMedium size\n\n");
	printf("7- Dessert\t\tRM3.50\t\tIce cream/pie/cake\n\n");
	printf("8- Upgrade meal\t\tRM1.00\t\tSmall to medium/medium to larger\n\n");
	printf("\n");
	Printf("\n\n\t Please enter the required menu number: ");
	scanf( "%d", &code);
	//Error Handling
	while(code!='1' && code!='2' && code!='3' && code!='4' && code!='5' && code!='6' && code!='7' && code!='8' && code!='Q' && code!='q')
	{
		printf("\n\n\tNo such menu in offered! Please enter the right menu number: ");
		scanf( "%d", &code);
	}

	switch(code)
	{
	case '1':
		printf("\nTotal: RM8.00");
		break;
	case '2':
		printf("\nTotal: RM5.00");
		break;
	case '3':
		printf("\nTotal: RM6.00");
		break;
	case '4':
		print("\nTotal: RM3.00");
		break;
	case '5':
		printf("\nTotal: RM2.00");
		break;
	case '6':
		printf("\nTotal: RM3.00");
		break;
	case '7':
		printf("\nTotal: RM3.50");
		break;
	case '8':
		printf("\nTotal: RM1.00");
		break;
	case 'Q':case 'q':
		system("cls");
		printf("\t You are exiting the system!\n");
		break;
	}
}
	//end of MainMenu()

void PaymentMode()
{
	char code;
	system("cls");
	printf("\t Enter Customer Mode of Payment\n");
	printf("\t 1-Credit Card\n");
	printf("\t 2-Debit Card\n");
	printf("\t 3-Cash\n");
	printf("\t 4-He has no money, proceed to kick him out!\n");
	scanf("%d", &code);
	//Error Handling
	while(code!='1' && code!='2' && code!='3' && code!='4' && code!='Q' && code!='q')
	{
		printf("\n\n\tNo such menu in offered! Please enter the right menu number: ");
		scanf( "%d", &code);
	}

	switch(code)
	{
	case '1':
		printf("\nPayment is now in Credit Card, additional 3% will be charged!");
		break;
	case '2':
		printf("\nNo additonal charges!");
		break;
	case '3':
		printf("\nNo additional charges!");
		break;
	case '4':
		printf("\nNo additional charges!");
		break;
	case 'Q': case 'q':
		system("cls");
		printf("\tYou are exiting the system!\n");
		break;

	}
	getchar();
	return 0;
}
//end of PaymentMode

Ok guys, as you can see above is the code for the application. I'm still very noob at programming, would really appreciate if you could point out the mistakes there. I know its messy, but help me out please. The login was taken from some post here. I didn't do the login part.

The problem:
When building the solution in MS Visual Studio 2008, had these following errors:
Error 10 error LNK2019: unresolved external symbol _print referenced in function _MainMenu billingsystem.obj Fast Food Billing System_pre
***
Error 11 error LNK2019: unresolved external symbol _Printf referenced in function _MainMenu billingsystem.obj Fast Food Billing System_pre
***
Error 12 fatal error LNK1120: 2 unresolved externals F:\Users\PuttyKitties\Documents\Visual Studio 2008\Projects\Fast Food Billing System_pre\Debug\Fast Food Billing System_pre.exe Fast Food Billing System_pre

ok, checked that. 2 more errors! OMG.

Updated Code, slightly.

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <conio.h>

/* Function prototypes */
void MainMenu();
void PurchaseMeal();
void PaymentMode();
void get_password ( char *pwd, int size );
int is_authorized ( const char *uid, const char *pwd );

#define FIELD_SIZE 25
#define length(array) ( sizeof (array) / sizeof (array)[i] )

struct account {
  char *id;
  char *password;
};

static struct account accounts[] = {
  { "alexander", "iamsolame" },
  { "haisham", "battlefiedheroes" },
  { "albert", "booties" }
};

int is_authorized ( const char *uid, const char *pwd )
{
  int i;

  for ( i = 0; i < length ( accounts ); i++ ) {
    if ( stricmp ( uid, accounts[i].id ) == 0 && 
         strcmp ( pwd, accounts[i].password ) ==0 ) 
    {
      return 1;
    }
  }

  return 0;
}

void get_password ( char *pwd, int size )
{
  int i = 0;
  int ch;

  while ( i < size - 1 && ( ch = getch() ) != '\r' ) {
    if ( ch == '\b' ) {
      if ( i != 0 ) {
        printf ( "\b%c\b", ' ' );
        --i;
      }
    }
    else {
		putchar ( '#' );
      pwd[i++] = (char)ch;
    }
  }

  pwd[i] = '\0';
}

//Main Method
int main(void)
{
  char uid[FIELD_SIZE];
  char pwd[FIELD_SIZE];
  printf("**********Welcome to Kitties Fastfood Restaurant**********\n\n\n\n");
  printf("Login by keying in your details below\n\n");

  printf ( "User ID: " );
  fflush ( stdout );

  if ( fgets ( uid, sizeof uid, stdin ) != NULL ) {
    char *newline = strchr ( uid, '\n' );

    
    if ( newline != NULL )
      *newline = '\0';

    printf ( "Password: " );
    fflush ( stdout );

    get_password ( pwd, sizeof pwd );

    if ( is_authorized ( uid, pwd ) )
      printf("\n\n\t\t>>USER AUTHENTICATED<<\n");
    else
      printf("\n\n\t\t<<NO SUCH LOGIN INFORMATION!>>\n");
  }
  getchar();
  return 0;
}

void MainMenu()
{
	char code;
	system("cls");
	printf("***Welcome to Kitties FastFood***\n\n\n");
	printf("\t\nCusotmer is:\n");
	printf("\t 1- Dining in.\n");
	printf("\t 2- Taking away.\n");
	//Error Handling
	while(code!='1' && code!='2' && code!='Q' && code!='q')
	{
		printf("\n\n\tNo such input! Enter again!");
		scanf( "%d", &code);
	}

	switch(code)
	{
	case '1':
		printf("\t Addtional 10% charges will be added.\n");
		break;
	case '2':
		printf("\t Additonal 5% charges will be added.\n");
		break;
	case 'Q':case 'q':
		system("cls");
		printf("\t You are exiting the system!\n");
		break;
	}
}

void PurchaseMeal()
{
	char code;
	system("cls");
	printf("***Welcome to Kitties FastFood***\n\n\n");
	printf("Available menu selection is as below:\n\n");
	printf("Item:\t\t\tPrice:\t\tRemarks:\n");
	printf("1- Lunch/Dinner Set\tRM8.00\t\t1 burger/chicken, 1 drink (M)\n");
	printf("\t\t\t\t\t1 french fries (M)\n\n");
	printf("2- Breakfast Set\tRM5.00\t\t1 breakfast, 1 drink (M)\n\n");
	printf("3- Kiddies Set\t\tRM6.00\t\t1 buerger/chicken, 1 drink (S)\n");
	printf("\t\t\t\t\t1 french fries (S)\n\n");
	printf("4- Promotion\t\tRM3.00\t\tburger/chicken\n\n");
	printf("5- Drink\t\tRM2.00\t\tMedium size\n\n");
	printf("6- French Fries\t\tRM3.00\t\tMedium size\n\n");
	printf("7- Dessert\t\tRM3.50\t\tIce cream/pie/cake\n\n");
	printf("8- Upgrade meal\t\tRM1.00\t\tSmall to medium/medium to larger\n\n");
	printf("\n");
	Printf("\n\n\t Please enter the required menu number: ");
	scanf( "%d", &code);
	//Error Handling
	while(code!='1' && code!='2' && code!='3' && code!='4' && code!='5' && code!='6' && code!='7' && code!='8' && code!='Q' && code!='q')
	{
		printf("\n\n\tNo such menu in offered! Please enter the right menu number: ");
		scanf( "%d", &code);
	}

	switch(code)
	{
	case '1':
		printf("\nTotal: RM8.00");
		break;
	case '2':
		printf("\nTotal: RM5.00");
		break;
	case '3':
		printf("\nTotal: RM6.00");
		break;
	case '4':
		printf("\nTotal: RM3.00");
		break;
	case '5':
		printf("\nTotal: RM2.00");
		break;
	case '6':
		printf("\nTotal: RM3.00");
		break;
	case '7':
		printf("\nTotal: RM3.50");
		break;
	case '8':
		printf("\nTotal: RM1.00");
		break;
	case 'Q':case 'q':
		system("cls");
		printf("\t You are exiting the system!\n");
		break;
	}
}
	//end of MainMenu()

void PaymentMode()
{
	char code;
	system("cls");
	printf("\t Enter Customer Mode of Payment\n");
	printf("\t 1-Credit Card\n");
	printf("\t 2-Debit Card\n");
	printf("\t 3-Cash\n");
	printf("\t 4-He has no money, proceed to kick him out!\n");
	scanf("%d", &code);
	//Error Handling
	while(code!='1' && code!='2' && code!='3' && code!='4' && code!='Q' && code!='q')
	{
		printf("\n\n\tNo such menu in offered! Please enter the right menu number: ");
		scanf( "%d", &code);
	}

	switch(code)
	{
	case '1':
		printf("\nPayment is now in Credit Card, additional 3% will be charged!");
		break;
	case '2':
		printf("\nNo additonal charges!");
		break;
	case '3':
		printf("\nNo additional charges!");
		break;
	case '4':
		printf("\nNo additional charges!");
		break;
	case 'Q': case 'q':
		system("cls");
		printf("\tYou are exiting the system!\n");
		break;

	}
	getchar();
	return 0;
}
//end of PaymentMode

2 more errors stating:
Error 11 error LNK2019: unresolved external symbol _Printf referenced in function _PurchaseMeal System.obj FastFood Billing System

Error 12 fatal error LNK1120: 1 unresolved externals F:\Users\PuttyKitties\Documents\Visual Studio 2008\Projects\FastFood Billing System\Debug\FastFood Billing System.exe FastFood Billing System

Edited 6 Years Ago by kingster113: n/a

And one more thing, can you guys guide me on how to say:

As you can see there are taxes involved in the whole process. Is there a way for me to say if user chooses Case 1 in PurchaseMeal and Case 1 in PaymentMethod, then i can take both cases entered and make the calculation in a new function called PrintBill(). Or is there any other way...?

Ok guys, I managed to solve the errors. Now it can be ran. But now here's the problem again:

Wait, code has been updated:

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>

/* Function prototypes */
void MainMenu();
void PurchaseMeal1();
void PurchaseMeal2();
void PurchaseMeal3();
void PurchaseMeal4();
void get_password ( char *pwd, int size );
int is_authorized ( const char *uid, const char *pwd );

#define FIELD_SIZE 25
#define length(array) ( sizeof (array) / sizeof (array)[i] )

struct account {
  char *id;
  char *password;
};

static struct account accounts[] = {
  { "alexander", "iamsolame" },
  { "haisham", "battlefiedheroes" },
  { "albert", "booties" }
};

int is_authorized ( const char *uid, const char *pwd )
{
  int i;

  for ( i = 0; i < length ( accounts ); i++ ) {
    if ( stricmp ( uid, accounts[i].id ) == 0 && 
         strcmp ( pwd, accounts[i].password ) ==0 ) 
    {
      return 1;
    }
  }

  return 0;
}

void get_password ( char *pwd, int size )
{
  int i = 0;
  int ch;

  while ( i < size - 1 && ( ch = getch() ) != '\r' ) {
    if ( ch == '\b' ) {
      if ( i != 0 ) {
        printf ( "\b%c\b", ' ' );
        --i;
      }
    }
    else {
		putchar ( '#' );
      pwd[i++] = (char)ch;
    }
  }

  pwd[i] = '\0';
}

//Main Method
int main(void)
{
  char uid[FIELD_SIZE];
  char pwd[FIELD_SIZE];
  printf("**********Welcome to Kitties Fastfood Restaurant**********\n\n\n\n");
  printf("Login by keying in your details below\n\n");

  printf ( "User ID: " );
  fflush ( stdout );

  if ( fgets ( uid, sizeof uid, stdin ) != NULL ) {
    char *newline = strchr ( uid, '\n' );

    
    if ( newline != NULL )
      *newline = '\0';

    printf ( "Password: " );
    fflush ( stdout );

    get_password ( pwd, sizeof pwd );

    if ( is_authorized ( uid, pwd ) )
      printf("\n\n\t\t>>USER AUTHENTICATED<<\n");
    else
      printf("\n\n\t\t<<NO SUCH LOGIN INFORMATION!>>\n\a");
  }
  getchar();
  MainMenu();
}

void MainMenu()
{
	char code;
	system("cls");
	printf("***Welcome to Kitties FastFood***\n\n\n");
	printf("\t\nCusotmer is:\n");
	printf("\t 1- Dining in & paying with Cash.\n");
	printf("\t 2- Taking away & paying with Cash.\n");
	printf("\t 3- Dining in & paying with Credit Card.\n");
	printf("\t 4- Taking away & paying with Credit Card.\n");
	//Error Handling
	while(code!='1' && code!='2' && code!='3' && code!='4' && code!='Q' && code!='q')
	{
		printf("\n\n\tNo such input! Enter again!\a");
		scanf( "%d", &code);
	}

	switch(code)
	{
	case '1':
		PurchaseMeal1();
		printf("\t Addtional 10% service charges will be added.\n");
		break;
	case '2':
		PurchaseMeal2();
		printf("\t Additonal 5% service charges will be added.\n");
		break;
	case '3':
		PurchaseMeal3();
		printf("\t Additional 10% service charges + 3 % credit card charges will be added.\n");
		break;
	case '4':
		PurchaseMeal4();
		printf("\t Additional 10% service charges + 3 % credit card charges will be added.\n");
		break;
	case 'Q':case 'q':
		system("cls");
		printf("\t You are exiting the system!\n\a");
		break;
	}
}

void PurchaseMeal1()
{
	int Quantity, CustomerName;
	char code;
	system("cls");
	printf("***Welcome to Kitties FastFood***\n\n\n");
	printf("Available menu selection is as below:\n\n");
	printf("Item:\t\t\tPrice:\t\tRemarks:\n");
	printf("1- Lunch/Dinner Set\tRM8.00\t\t1 burger/chicken, 1 drink (M)\n");
	printf("\t\t\t\t\t1 french fries (M)\n\n");
	printf("2- Breakfast Set\tRM5.00\t\t1 breakfast, 1 drink (M)\n\n");
	printf("3- Kiddies Set\t\tRM6.00\t\t1 buerger/chicken, 1 drink (S)\n");
	printf("\t\t\t\t\t1 french fries (S)\n\n");
	printf("4- Promotion\t\tRM3.00\t\tburger/chicken\n\n");
	printf("5- Drink\t\tRM2.00\t\tMedium size\n\n");
	printf("6- French Fries\t\tRM3.00\t\tMedium size\n\n");
	printf("7- Dessert\t\tRM3.50\t\tIce cream/pie/cake\n\n");
	printf("8- Upgrade meal\t\tRM1.00\t\tSmall to medium/medium to larger\n\n");
	printf("\n");
	printf("\n\n\t Please enter customer name: ");
	scanf( "%s", &CustomerName);
	printf("\n\n\t Please enter the quantity: ");
	scanf( "%d", &Quantity);
	printf("\n\n\t Please enter the required menu number: ");
	scanf( "%d", &code);
	//Error Handling
	while(code!='1' && code!='2' && code!='3' && code!='4' && code!='5' && code!='6' && code!='7' && code!='Q' && code!='q')
	{
		printf("\n\n\tNo such menu in offered! Please enter the right menu number:\a ");
		scanf( "%d", &code);
	}

	switch(code)
	{
	case '1':
		printf("\nTotal: RM9.24");
		break;
	case '2':
		printf("\nTotal: RM5.78");
		break;
	case '3':
		printf("\nTotal: RM6.93");
		break;
	case '4':
		printf("\nTotal: RM3.47");
		break;
	case '5':
		printf("\nTotal: RM2.31");
		break;
	case '6':
		printf("\nTotal: RM3.47");
		break;
	case '7':
		printf("\nTotal: RM4.04");
		break;
	case 'Q':case 'q':
		system("cls");
		printf("\t You are exiting the system!\n");
		break;
	}
}
void PurchaseMeal2()
{
	int Quantity, CustomerName;
	char code;
	system("cls");
	printf("***Welcome to Kitties FastFood***\n\n\n");
	printf("Available menu selection is as below:\n\n");
	printf("Item:\t\t\tPrice:\t\tRemarks:\n");
	printf("1- Lunch/Dinner Set\tRM8.00\t\t1 burger/chicken, 1 drink (M)\n");
	printf("\t\t\t\t\t1 french fries (M)\n\n");
	printf("2- Breakfast Set\tRM5.00\t\t1 breakfast, 1 drink (M)\n\n");
	printf("3- Kiddies Set\t\tRM6.00\t\t1 buerger/chicken, 1 drink (S)\n");
	printf("\t\t\t\t\t1 french fries (S)\n\n");
	printf("4- Promotion\t\tRM3.00\t\tburger/chicken\n\n");
	printf("5- Drink\t\tRM2.00\t\tMedium size\n\n");
	printf("6- French Fries\t\tRM3.00\t\tMedium size\n\n");
	printf("7- Dessert\t\tRM3.50\t\tIce cream/pie/cake\n\n");
	printf("8- Upgrade meal\t\tRM1.00\t\tSmall to medium/medium to larger\n\n");
	printf("\n");
	printf("\n\n\t Please enter customer name: ");
	scanf( "%s", &CustomerName);
	printf("\n\n\t Please enter the quantity: ");
	scanf( "%d", &Quantity);
	printf("\n\n\t Please enter the required menu number: ");
	scanf( "%d", &code);
	//Error Handling
	while(code!='1' && code!='2' && code!='3' && code!='4' && code!='5' && code!='6' && code!='7' && code!='Q' && code!='q')
	{
		printf("\n\n\tNo such menu in offered! Please enter the right menu number:\a ");
		scanf( "%d", &code);
	}

	switch(code)
	{
	case '1':
		printf("\nTotal: RM8.82");
		break;
	case '2':
		printf("\nTotal: RM5.51");
		break;
	case '3':
		printf("\nTotal: RM6.61");
		break;
	case '4':
		printf("\nTotal: RM3.31");
		break;
	case '5':
		printf("\nTotal: RM2.21");
		break;
	case '6':
		printf("\nTotal: RM3.31");
		break;
	case '7':
		printf("\nTotal: RM3.89");
		break;
	case 'Q':case 'q':
		system("cls");
		printf("\t You are exiting the system!\n");
		break;
	}
}
void PurchaseMeal3()
{
	int Quantity, CustomerName;
	char code;
	system("cls");
	printf("***Welcome to Kitties FastFood***\n\n\n");
	printf("Available menu selection is as below:\n\n");
	printf("Item:\t\t\tPrice:\t\tRemarks:\n");
	printf("1- Lunch/Dinner Set\tRM8.00\t\t1 burger/chicken, 1 drink (M)\n");
	printf("\t\t\t\t\t1 french fries (M)\n\n");
	printf("2- Breakfast Set\tRM5.00\t\t1 breakfast, 1 drink (M)\n\n");
	printf("3- Kiddies Set\t\tRM6.00\t\t1 buerger/chicken, 1 drink (S)\n");
	printf("\t\t\t\t\t1 french fries (S)\n\n");
	printf("4- Promotion\t\tRM3.00\t\tburger/chicken\n\n");
	printf("5- Drink\t\tRM2.00\t\tMedium size\n\n");
	printf("6- French Fries\t\tRM3.00\t\tMedium size\n\n");
	printf("7- Dessert\t\tRM3.50\t\tIce cream/pie/cake\n\n");
	printf("8- Upgrade meal\t\tRM1.00\t\tSmall to medium/medium to larger\n\n");
	printf("\n");
	printf("\n\n\t Please enter customer name: ");
	scanf( "%s", &CustomerName);
	printf("\n\n\t Please enter the quantity: ");
	scanf( "%d", &Quantity);
	printf("\n\n\t Please enter the required menu number: ");
	scanf( "%d", &code);
	//Error Handling
	while(code!='1' && code!='2' && code!='3' && code!='4' && code!='5' && code!='6' && code!='7' && code!='Q' && code!='q')
	{
		printf("\n\n\tNo such menu in offered! Please enter the right menu number:\a ");
		scanf( "%d", &code);
	}

	switch(code)
	{
	case '1':
		printf("\nTotal: RM9.51");
		break;
	case '2':
		printf("\nTotal: RM5.95");
		break;
	case '3':
		printf("\nTotal: RM7.14");
		break;
	case '4':
		printf("\nTotal: RM3.57");
		break;
	case '5':
		printf("\nTotal: RM2.38");
		break;
	case '6':
		printf("\nTotal: RM3.57");
		break;
	case '7':
		printf("\nTotal: RM4.16");
		break;
	case 'Q':case 'q':
		system("cls");
		printf("\t You are exiting the system!\n");
		break;
	}
}
void PurchaseMeal4()
{
	int Quantity, CustomerName;
	char code;
	system("cls");
	printf("***Welcome to Kitties FastFood***\n\n\n");
	printf("Available menu selection is as below:\n\n");
	printf("Item:\t\t\tPrice:\t\tRemarks:\n");
	printf("1- Lunch/Dinner Set\tRM8.00\t\t1 burger/chicken, 1 drink (M)\n");
	printf("\t\t\t\t\t1 french fries (M)\n\n");
	printf("2- Breakfast Set\tRM5.00\t\t1 breakfast, 1 drink (M)\n\n");
	printf("3- Kiddies Set\t\tRM6.00\t\t1 buerger/chicken, 1 drink (S)\n");
	printf("\t\t\t\t\t1 french fries (S)\n\n");
	printf("4- Promotion\t\tRM3.00\t\tburger/chicken\n\n");
	printf("5- Drink\t\tRM2.00\t\tMedium size\n\n");
	printf("6- French Fries\t\tRM3.00\t\tMedium size\n\n");
	printf("7- Dessert\t\tRM3.50\t\tIce cream/pie/cake\n\n");
	printf("8- Upgrade meal\t\tRM1.00\t\tSmall to medium/medium to larger\n\n");
	printf("\n");
	printf("\n\n\t Please enter customer name: ");
	scanf( "%s", &CustomerName);
	printf("\n\n\t Please enter the quantity: ");
	scanf( "%d", &Quantity);
	printf("\n\n\t Please enter the required menu number: ");
	scanf( "%d", &code);
	//Error Handling
	while(code!='1' && code!='2' && code!='3' && code!='4' && code!='5' && code!='6' && code!='7' && code!='Q' && code!='q')
	{
		printf("\n\n\tNo such menu in offered! Please enter the right menu number:\a ");
		scanf( "%d", &code);
	}

	switch(code)
	{
	case '1':
		printf("\nTotal: RM9.08");
		break;
	case '2':
		printf("\nTotal: RM5.47");
		break;
	case '3':
		printf("\nTotal: RM6.81");
		break;
	case '4':
		printf("\nTotal: RM3.41");
		break;
	case '5':
		printf("\nTotal: RM2.28");
		break;
	case '6':
		printf("\nTotal: RM3.41");
		break;
	case '7':
		printf("\nTotal: RM4.01");
		break;
	case 'Q':case 'q':
		system("cls");
		printf("\t You are exiting the system!\n");
		break;
	}
}

I get "Run-Time Check Failure #3 - The variable 'code' is being used without being initialized."
Can you guys tell me what's that thing???

Ok guys, I managed to solve the errors. Now it can be ran. But now here's the problem again:

Wait, code has been updated:

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>

/* Function prototypes */
void MainMenu();
void PurchaseMeal1();
void PurchaseMeal2();
void PurchaseMeal3();
void PurchaseMeal4();
void get_password ( char *pwd, int size );
int is_authorized ( const char *uid, const char *pwd );

#define FIELD_SIZE 25
#define length(array) ( sizeof (array) / sizeof (array)[i] )

struct account {
  char *id;
  char *password;
};

static struct account accounts[] = {
  { "alexander", "iamsolame" },
  { "haisham", "battlefiedheroes" },
  { "albert", "booties" }
};

int is_authorized ( const char *uid, const char *pwd )
{
  int i;

  for ( i = 0; i < length ( accounts ); i++ ) {
    if ( stricmp ( uid, accounts[i].id ) == 0 && 
         strcmp ( pwd, accounts[i].password ) ==0 ) 
    {
      return 1;
    }
  }

  return 0;
}

void get_password ( char *pwd, int size )
{
  int i = 0;
  int ch;

  while ( i < size - 1 && ( ch = getch() ) != '\r' ) {
    if ( ch == '\b' ) {
      if ( i != 0 ) {
        printf ( "\b%c\b", ' ' );
        --i;
      }
    }
    else {
		putchar ( '#' );
      pwd[i++] = (char)ch;
    }
  }

  pwd[i] = '\0';
}

//Main Method
int main(void)
{
  char uid[FIELD_SIZE];
  char pwd[FIELD_SIZE];
  printf("**********Welcome to Kitties Fastfood Restaurant**********\n\n\n\n");
  printf("Login by keying in your details below\n\n");

  printf ( "User ID: " );
  fflush ( stdout );

  if ( fgets ( uid, sizeof uid, stdin ) != NULL ) {
    char *newline = strchr ( uid, '\n' );

    
    if ( newline != NULL )
      *newline = '\0';

    printf ( "Password: " );
    fflush ( stdout );

    get_password ( pwd, sizeof pwd );

    if ( is_authorized ( uid, pwd ) )
      printf("\n\n\t\t>>USER AUTHENTICATED<<\n");
    else
      printf("\n\n\t\t<<NO SUCH LOGIN INFORMATION!>>\n\a");
  }
  getchar();
  MainMenu();
}

void MainMenu()
{
	char code;
	system("cls");
	printf("***Welcome to Kitties FastFood***\n\n\n");
	printf("\t\nCusotmer is:\n");
	printf("\t 1- Dining in & paying with Cash.\n");
	printf("\t 2- Taking away & paying with Cash.\n");
	printf("\t 3- Dining in & paying with Credit Card.\n");
	printf("\t 4- Taking away & paying with Credit Card.\n");
	//Error Handling
	while(code!='1' && code!='2' && code!='3' && code!='4' && code!='Q' && code!='q')
	{
		printf("\n\n\tNo such input! Enter again!\a");
		scanf( "%d", &code);
	}

	switch(code)
	{
	case '1':
		PurchaseMeal1();
		printf("\t Addtional 10% service charges will be added.\n");
		break;
	case '2':
		PurchaseMeal2();
		printf("\t Additonal 5% service charges will be added.\n");
		break;
	case '3':
		PurchaseMeal3();
		printf("\t Additional 10% service charges + 3 % credit card charges will be added.\n");
		break;
	case '4':
		PurchaseMeal4();
		printf("\t Additional 10% service charges + 3 % credit card charges will be added.\n");
		break;
	case 'Q':case 'q':
		system("cls");
		printf("\t You are exiting the system!\n\a");
		break;
	}
}

void PurchaseMeal1()
{
	int Quantity, CustomerName;
	char code;
	system("cls");
	printf("***Welcome to Kitties FastFood***\n\n\n");
	printf("Available menu selection is as below:\n\n");
	printf("Item:\t\t\tPrice:\t\tRemarks:\n");
	printf("1- Lunch/Dinner Set\tRM8.00\t\t1 burger/chicken, 1 drink (M)\n");
	printf("\t\t\t\t\t1 french fries (M)\n\n");
	printf("2- Breakfast Set\tRM5.00\t\t1 breakfast, 1 drink (M)\n\n");
	printf("3- Kiddies Set\t\tRM6.00\t\t1 buerger/chicken, 1 drink (S)\n");
	printf("\t\t\t\t\t1 french fries (S)\n\n");
	printf("4- Promotion\t\tRM3.00\t\tburger/chicken\n\n");
	printf("5- Drink\t\tRM2.00\t\tMedium size\n\n");
	printf("6- French Fries\t\tRM3.00\t\tMedium size\n\n");
	printf("7- Dessert\t\tRM3.50\t\tIce cream/pie/cake\n\n");
	printf("8- Upgrade meal\t\tRM1.00\t\tSmall to medium/medium to larger\n\n");
	printf("\n");
	printf("\n\n\t Please enter customer name: ");
	scanf( "%s", &CustomerName);
	printf("\n\n\t Please enter the quantity: ");
	scanf( "%d", &Quantity);
	printf("\n\n\t Please enter the required menu number: ");
	scanf( "%d", &code);
	//Error Handling
	while(code!='1' && code!='2' && code!='3' && code!='4' && code!='5' && code!='6' && code!='7' && code!='Q' && code!='q')
	{
		printf("\n\n\tNo such menu in offered! Please enter the right menu number:\a ");
		scanf( "%d", &code);
	}

	switch(code)
	{
	case '1':
		printf("\nTotal: RM9.24");
		break;
	case '2':
		printf("\nTotal: RM5.78");
		break;
	case '3':
		printf("\nTotal: RM6.93");
		break;
	case '4':
		printf("\nTotal: RM3.47");
		break;
	case '5':
		printf("\nTotal: RM2.31");
		break;
	case '6':
		printf("\nTotal: RM3.47");
		break;
	case '7':
		printf("\nTotal: RM4.04");
		break;
	case 'Q':case 'q':
		system("cls");
		printf("\t You are exiting the system!\n");
		break;
	}
}
void PurchaseMeal2()
{
	int Quantity, CustomerName;
	char code;
	system("cls");
	printf("***Welcome to Kitties FastFood***\n\n\n");
	printf("Available menu selection is as below:\n\n");
	printf("Item:\t\t\tPrice:\t\tRemarks:\n");
	printf("1- Lunch/Dinner Set\tRM8.00\t\t1 burger/chicken, 1 drink (M)\n");
	printf("\t\t\t\t\t1 french fries (M)\n\n");
	printf("2- Breakfast Set\tRM5.00\t\t1 breakfast, 1 drink (M)\n\n");
	printf("3- Kiddies Set\t\tRM6.00\t\t1 buerger/chicken, 1 drink (S)\n");
	printf("\t\t\t\t\t1 french fries (S)\n\n");
	printf("4- Promotion\t\tRM3.00\t\tburger/chicken\n\n");
	printf("5- Drink\t\tRM2.00\t\tMedium size\n\n");
	printf("6- French Fries\t\tRM3.00\t\tMedium size\n\n");
	printf("7- Dessert\t\tRM3.50\t\tIce cream/pie/cake\n\n");
	printf("8- Upgrade meal\t\tRM1.00\t\tSmall to medium/medium to larger\n\n");
	printf("\n");
	printf("\n\n\t Please enter customer name: ");
	scanf( "%s", &CustomerName);
	printf("\n\n\t Please enter the quantity: ");
	scanf( "%d", &Quantity);
	printf("\n\n\t Please enter the required menu number: ");
	scanf( "%d", &code);
	//Error Handling
	while(code!='1' && code!='2' && code!='3' && code!='4' && code!='5' && code!='6' && code!='7' && code!='Q' && code!='q')
	{
		printf("\n\n\tNo such menu in offered! Please enter the right menu number:\a ");
		scanf( "%d", &code);
	}

	switch(code)
	{
	case '1':
		printf("\nTotal: RM8.82");
		break;
	case '2':
		printf("\nTotal: RM5.51");
		break;
	case '3':
		printf("\nTotal: RM6.61");
		break;
	case '4':
		printf("\nTotal: RM3.31");
		break;
	case '5':
		printf("\nTotal: RM2.21");
		break;
	case '6':
		printf("\nTotal: RM3.31");
		break;
	case '7':
		printf("\nTotal: RM3.89");
		break;
	case 'Q':case 'q':
		system("cls");
		printf("\t You are exiting the system!\n");
		break;
	}
}
void PurchaseMeal3()
{
	int Quantity, CustomerName;
	char code;
	system("cls");
	printf("***Welcome to Kitties FastFood***\n\n\n");
	printf("Available menu selection is as below:\n\n");
	printf("Item:\t\t\tPrice:\t\tRemarks:\n");
	printf("1- Lunch/Dinner Set\tRM8.00\t\t1 burger/chicken, 1 drink (M)\n");
	printf("\t\t\t\t\t1 french fries (M)\n\n");
	printf("2- Breakfast Set\tRM5.00\t\t1 breakfast, 1 drink (M)\n\n");
	printf("3- Kiddies Set\t\tRM6.00\t\t1 buerger/chicken, 1 drink (S)\n");
	printf("\t\t\t\t\t1 french fries (S)\n\n");
	printf("4- Promotion\t\tRM3.00\t\tburger/chicken\n\n");
	printf("5- Drink\t\tRM2.00\t\tMedium size\n\n");
	printf("6- French Fries\t\tRM3.00\t\tMedium size\n\n");
	printf("7- Dessert\t\tRM3.50\t\tIce cream/pie/cake\n\n");
	printf("8- Upgrade meal\t\tRM1.00\t\tSmall to medium/medium to larger\n\n");
	printf("\n");
	printf("\n\n\t Please enter customer name: ");
	scanf( "%s", &CustomerName);
	printf("\n\n\t Please enter the quantity: ");
	scanf( "%d", &Quantity);
	printf("\n\n\t Please enter the required menu number: ");
	scanf( "%d", &code);
	//Error Handling
	while(code!='1' && code!='2' && code!='3' && code!='4' && code!='5' && code!='6' && code!='7' && code!='Q' && code!='q')
	{
		printf("\n\n\tNo such menu in offered! Please enter the right menu number:\a ");
		scanf( "%d", &code);
	}

	switch(code)
	{
	case '1':
		printf("\nTotal: RM9.51");
		break;
	case '2':
		printf("\nTotal: RM5.95");
		break;
	case '3':
		printf("\nTotal: RM7.14");
		break;
	case '4':
		printf("\nTotal: RM3.57");
		break;
	case '5':
		printf("\nTotal: RM2.38");
		break;
	case '6':
		printf("\nTotal: RM3.57");
		break;
	case '7':
		printf("\nTotal: RM4.16");
		break;
	case 'Q':case 'q':
		system("cls");
		printf("\t You are exiting the system!\n");
		break;
	}
}
void PurchaseMeal4()
{
	int Quantity, CustomerName;
	char code;
	system("cls");
	printf("***Welcome to Kitties FastFood***\n\n\n");
	printf("Available menu selection is as below:\n\n");
	printf("Item:\t\t\tPrice:\t\tRemarks:\n");
	printf("1- Lunch/Dinner Set\tRM8.00\t\t1 burger/chicken, 1 drink (M)\n");
	printf("\t\t\t\t\t1 french fries (M)\n\n");
	printf("2- Breakfast Set\tRM5.00\t\t1 breakfast, 1 drink (M)\n\n");
	printf("3- Kiddies Set\t\tRM6.00\t\t1 buerger/chicken, 1 drink (S)\n");
	printf("\t\t\t\t\t1 french fries (S)\n\n");
	printf("4- Promotion\t\tRM3.00\t\tburger/chicken\n\n");
	printf("5- Drink\t\tRM2.00\t\tMedium size\n\n");
	printf("6- French Fries\t\tRM3.00\t\tMedium size\n\n");
	printf("7- Dessert\t\tRM3.50\t\tIce cream/pie/cake\n\n");
	printf("8- Upgrade meal\t\tRM1.00\t\tSmall to medium/medium to larger\n\n");
	printf("\n");
	printf("\n\n\t Please enter customer name: ");
	scanf( "%s", &CustomerName);
	printf("\n\n\t Please enter the quantity: ");
	scanf( "%d", &Quantity);
	printf("\n\n\t Please enter the required menu number: ");
	scanf( "%d", &code);
	//Error Handling
	while(code!='1' && code!='2' && code!='3' && code!='4' && code!='5' && code!='6' && code!='7' && code!='Q' && code!='q')
	{
		printf("\n\n\tNo such menu in offered! Please enter the right menu number:\a ");
		scanf( "%d", &code);
	}

	switch(code)
	{
	case '1':
		printf("\nTotal: RM9.08");
		break;
	case '2':
		printf("\nTotal: RM5.47");
		break;
	case '3':
		printf("\nTotal: RM6.81");
		break;
	case '4':
		printf("\nTotal: RM3.41");
		break;
	case '5':
		printf("\nTotal: RM2.28");
		break;
	case '6':
		printf("\nTotal: RM3.41");
		break;
	case '7':
		printf("\nTotal: RM4.01");
		break;
	case 'Q':case 'q':
		system("cls");
		printf("\t You are exiting the system!\n");
		break;
	}
}

I get "Run-Time Check Failure #3 - The variable 'code' is being used without being initialized."
Can you guys tell me what's that thing???

This article has been dead for over six months. Start a new discussion instead.