its not c++ its c.Originally posted by ndmmxiaomayi:Paiseh....
Cannot help. I don't know C++
you show the whole code here , i understand C as i used it in polyOriginally posted by Ito_^:I'm doing some simple C standard coding on it.. but it gives me an "warning C4013: 'function1' undefined; assuming extern returning int". i think its compiler problem becuz it shouldn't give me any syntax error in the first place.
anyone knows why?
/*
ver 0.1
Allows user to key in multiple DVDs.
Allows user to enter his particular.
Displays all the DVDs on screen.
Allows user to choose three DVD code.
To Do:
- Use struct to store multiple user information.
- Data and format validation.
*/
#include
#include
#include
void main()
{
// Menu Variables
int choice, showMenu = 1;
// DVD Variables
int DVD_Code_DVD[999];
char DVD_Title[999][100], YearOfRelease[999][100];
float Price[999];
// Rental Variables
int Customer_ID, DVD_Code_Rental, Rental_Counter;
char Customer_Name[100], DateOfRental[100], VIP[100];
//Other Variables
int breakCheck = 0;
int i = 0;
// Display Menu
do{
system("cls");
printf("\n\n ONLINE DVD RENTAL SYSTEM \n");
printf("\n\n(1) INPUT OF BOOKING:");
printf("\n\n(2) INPUT RENTALS INFORMATION:");
printf("\n\n(3) Display Rentals Summary :");
printf("\n\n(4) Display Statistics");
printf("\n\n(5) SYSTEM EXIT?");
printf("\n\n >> ENTER YOUR CHOICE:");
choice = getchar();
switch(choice) {
case '1':
function1();
//input of DVDs
for(i=0; i<1; i++) {
puts("Enter the following information. \n\n\n");
puts("DVD Code: ");
scanf("%s", &DVD_Code_DVD[i]);
puts("\nDVD Title: ");
scanf("%s", &DVD_Title[i]);
puts("\nYear Of Release");
scanf("%s", &YearOfRelease[i]);
puts("\nPrice: ");
scanf("%s", &Price[i]);
}
//end
break;
case '2':
//Input of Rentals
for(i=0; i<1; i++) {
puts("Enter the following information. \n\n\n");
puts("Customer ID: ");
scanf("%s", &Customer_ID);
puts("\nCustomer Name: ");
scanf("%s", &Customer_Name);
puts("\nDVD Code");
scanf("%s", &DVD_Code_Rental);
puts("\nVIP: ");
scanf("%s", &VIP[i]);
puts("\nDate of Rental: ");
scanf("%s", &DateOfRental);
puts("\nRental Counter: ");
scanf("%s", &Rental_Counter);
}
//end
puts("\n\n");
_sleep(2000);
system("pause");
puts("\n");
//Display All DVDs
for(i=0; i<1; i++) {
printf("\n\nDVD Information\n");
printf("DVD Code: %s\n", &DVD_Code_DVD[i]);
printf("DVD Title: %s\n", &DVD_Title[i]);
printf("Year of Release: %s\n", &YearOfRelease[i]);
printf("Price: %s\n", &Price[i]);
}
//end
//Allow User to Choose One.
for(i=0; i<1; i++) {
printf("\nEnter DVD Code: ");
scanf("%s", &DVD_Code_Rental);
}
//end
break;
case '3':
puts("function 3");
break;
case '4':
puts("function 4");
break;
case '5':
puts("function 5");
showMenu = 0;
break;
default:
puts("\n\nPlease try again.\n\n");
}
}while(showMenu == 1);
printf("\n\nTHANK YOU! GOOD DAY!\n\n");
}
void function1() {
puts("\ntest1\n");
}
Originally posted by Ito_^:You got to pre-declare (see above code in red) that procedure before main() if you intend to write the actual procedure after main(). The compiler compiles the codes top to bottom, so there is no way it can know wat function1 does when it can't find in the declarations before reaching that line calling for it.
very very simple one.code:
/*
ver 0.1
Allows user to key in multiple DVDs.
Allows user to enter his particular.
Displays all the DVDs on screen.
Allows user to choose three DVD code.
To Do:
- Use struct to store multiple user information.
- Data and format validation.
*/
#include
#include
#include
void function1(void); // Insert here
void main()
{
// Menu Variables
int choice, showMenu = 1;
// DVD Variables
int DVD_Code_DVD[999];
char DVD_Title[999][100], YearOfRelease[999][100];
float Price[999];
// Rental Variables
int Customer_ID, DVD_Code_Rental, Rental_Counter;
char Customer_Name[100], DateOfRental[100], VIP[100];
//Other Variables
int breakCheck = 0;
int i = 0;
// Display Menu
do{
system("cls");
printf("\n\n ONLINE DVD RENTAL SYSTEM \n");
printf("\n\n(1) INPUT OF BOOKING:");
printf("\n\n(2) INPUT RENTALS INFORMATION:");
printf("\n\n(3) Display Rentals Summary :");
printf("\n\n(4) Display Statistics");
printf("\n\n(5) SYSTEM EXIT?");
printf("\n\n >> ENTER YOUR CHOICE:");
choice = getchar();
switch(choice) {
case '1':
[b]function1();
//input of DVDs
for(i=0; i<1; i++) {
puts("Enter the following information. \n\n\n");
puts("DVD Code: ");
scanf("%s", &DVD_Code_DVD[i]);
puts("\nDVD Title: ");
scanf("%s", &DVD_Title[i]);
puts("\nYear Of Release");
scanf("%s", &YearOfRelease[i]);
puts("\nPrice: ");
scanf("%s", &Price[i]);
}
//end
break;
case '2':
//Input of Rentals
for(i=0; i<1; i++) {
puts("Enter the following information. \n\n\n");
puts("Customer ID: ");
scanf("%s", &Customer_ID);
puts("\nCustomer Name: ");
scanf("%s", &Customer_Name);
puts("\nDVD Code");
scanf("%s", &DVD_Code_Rental);
puts("\nVIP: ");
scanf("%s", &VIP[i]);
puts("\nDate of Rental: ");
scanf("%s", &DateOfRental);
puts("\nRental Counter: ");
scanf("%s", &Rental_Counter);
}
//end
puts("\n\n");
_sleep(2000);
system("pause");
puts("\n");
//Display All DVDs
for(i=0; i<1; i++) {
printf("\n\nDVD Information\n");
printf("DVD Code: %s\n", &DVD_Code_DVD[i]);
printf("DVD Title: %s\n", &DVD_Title[i]);
printf("Year of Release: %s\n", &YearOfRelease[i]);
printf("Price: %s\n", &Price[i]);
}
//end
//Allow User to Choose One.
for(i=0; i<1; i++) {
printf("\nEnter DVD Code: ");
scanf("%s", &DVD_Code_Rental);
}
//end
break;
case '3':
puts("function 3");
break;
case '4':
puts("function 4");
break;
case '5':
puts("function 5");
showMenu = 0;
break;
default:
puts("\n\nPlease try again.\n\n");
}
}while(showMenu == 1);
printf("\n\nTHANK YOU! GOOD DAY!\n\n");
}
void function1() {
puts("\ntest1\n");
}
other funny thing is dat i cannot use %d to do i/o on screen. =.=""[/b]
diao!Originally posted by Twincat:You got to pre-declare (see above code in red) that procedure before main() if you intend to write the actual procedure after main(). The compiler compiles the codes top to bottom, so there is no way it can know wat function1 does when it can't find in the declarations before reaching that line calling for it.