Okay so I have a project, im almooost done, i just lack a certain function.
Code:
void add_record(record x, FILE *fp)
{
char ans;
int tempid;
do
{
system("cls");
INPUT:
printf("Student ID: "); scanf("%d", &x.idno);
fflush(stdin);
printf("First Name: "); gets(x.Fname);
printf("Last Name; "); gets(x.Lname);
strupr(x.Lname);
printf("Course: "); gets(x.course);
printf("Age: "); scanf("%d", &x.age);
fflush(stdin);
printf("Tuition: "); scanf("%f", &x.tuition);
system("cls");
printf("Enter another record? Y/N");
ans=toupper(getch());
system("cls");
fwrite(&x,sizeof(x),1,fp);
}while(ans=='Y');
fclose(fp);
}
If the user inputs a Student Number which already exists, i want my program to ask the user again for another number and display sumthing like "Student Number already exists. Try again"
I've tried working it out myself, but every time I input a Student Number , the program displays that it already exists, even though its not.
What do you suggest I do?? Pleassee i need help, the project is due tomorrow