sory if this was before but I realy can't find the answer...
Code:
#include <stdio.h>#include <stdlib.h>
#include <string.h>
#include <conio.h>
typedef struct
{ int day, month, year; } DATE;
typedef struct
{
DATA depdate;
char name;
int place;
char class;
int childrens;
} passager;
void menu(void);
void datentry (char *, int);
int main()
{
clrscr();
char name[40];
char class[15];
int n;
passager *p=NULL; //warning: 'p' is assigned a value that is never used
menu();
return 0;
}
void menu()
{ passager *p; int n;
int choice;
do
{
printf("\tMenu\n\n");
printf("1. data entry\n");
printf("2. Show passagers\n");
printf("3. Modify data\n");
printf("4. Search passager\n");
printf("5. Passagers sort\n");
printf("6. Add a passager\n");
printf("7. Insert a passager\n");
printf("8. Delete a passager\n");
printf("9. Save all data in a file\n");
printf("10. Read data from file\n");
printf("11. Stats\n");
printf("12. Exit\n");
scanf("%d",&choice);
switch(choice)
{
case 1: datentry(name,place); //here i have a problem with function parameters
break;
case 2: showpass();
break;
// ......
case 12: printf("Quiting...\n");
getch();
exit(0);
break;
default: printf("Wrong choice!\n");
break;
}
} while (choice != 12);
}
void datentry(passager *p, int n) // here i'm sure that it's wrong but i don't
{ know how it should be...
int i,k;
puts("Enter the number of passagers(<100): \n");
scanf("%d",&k);
for(i=0; i<k; i++)
{
printf("\t %d passager\n",i+1);
printf("Passager name: ");
fflush(stdin);
gets((*p).name); //Eror: Undefinied symbol 'name' and Cannot convert 'int' to 'char' and Type mismatch '_s' in call to gets(char *)'
printf("Passager's place: ");
scanf("%d", &(*p).place); //Eror: Undefinied symbol 'place'
printf("Passager's class(Business/Econom): ");
gets(class); //Eror: Expresion syntax
printf("Numaber o childrens: ");
scanf("%d" &(*p).childrens); //Eror: Illegal use if pointer
printf("Departure date(DD MM YY): ");
scanf("%d %d %d",&(*p).depdate->day,&(*p).depdate->month, &(*p).depdate.year); //and here some erors...
}
}
i wroted erors in comments