I have a problem that when the users type same id,they need to type name and id again. How can i only ask the users to input the id rather than both name and id,when the users type same id number.Please give me some hints how to do that.Thanks for your help!
struct student
{
intchar student_num;student_name[30];
char student_name[50];student_id[10];
int student_id[30];student_course_num[20];
int student_course[10];
};
int main()
{
struct student S;
int i,j,student_code=1;student_num;
printf("Enter the number of studentstudents:");
scanf("%d",&S.student_num&student_num);
int StuNum=S.student_num;
forfflush(i=0;i<StuNum;i++stdin)
{;
struct printf("Numberstudent ofS[student_num];
char StudentsTestForId[student_num][10];
int %d:\n"i,student_codej,student_code=1;
for(i=0;i<student_num;i++);
{
printf("Enter the name of student:");
scanffgets("%s",&SS[i].student_name[i]student_name,30,stdin);
fflush(stdin);
printf("Enter the Student ID (8 digits):");
scanffgets("%d",&SS[i].student_id[i]student_id,10,stdin);
fflush
strcpy(stdinTestForId[i],S[i].student_id);
for(j=0;j<i;j++)
{
if(S.student_id[j]==Sstrcmp(TestForId[j],S[i].student_id[i]student_id) //whether the id is same or not==0)
{
printf("<ID NUMBER HAS ALREADY EXITED>\n");
i--;
"The student id has already student_code--exit\n");
break;
}
}
student_code++;
}
}