do
	{
		++temp_week;
		system("cls");
		printf("\n");
		printf("\t\t   ***************************************\n");
		printf("\t\t   ***************************************\n");
		printf("\t\t   ***                                 ***\n");
		printf("\t\t   ***           WELCOME TO            ***\n");
		printf("\t\t   ***    CLASS ATTENDANCE SYSTEM      ***\n");
		printf("\t\t   ***                                 ***\n");
		printf("\t\t   ***************************************\n");
		printf("\t\t   ***************************************\n");
		printf("\n\n");
		printf("\t\t   ******** MARKING OF ATTENDANCE ********\n");
		printf("\t\t                     PRESENT = 1  ABSENT = 0\n\n");
	
	         for(i=0; fscanf(ReadFile,"%d|", &Student[i].studNo) != EOF; i++)
		{
			fscanf(ReadFile, "%d", &Student[i].regNo.year);
			fscanf(ReadFile, "%c", &Student[i].regNo.campus);
			fscanf(ReadFile, "%c", &Student[i].regNo.school);
			fscanf(ReadFile, "%c", &Student[i].regNo.level);
			fscanf(ReadFile, "%d|", &Student[i].regNo.serial_number);
			fscanf(ReadFile, "%[^|]|", &Student[i].student_Surname);
			fscanf(ReadFile, "%[^|]|", &Student[i].student_givenName);
			fscanf(ReadFile, "%[^|]|", &Student[i].gender);
			fscanf(ReadFile, "%[^|]|", &Student[i].father_name);
			fscanf(ReadFile, "%[^|]|", &Student[i].address1);
			fscanf(ReadFile, "%[^|]|", &Student[i].address2);
			fscanf(ReadFile, "%s", &Student[i].address3);

			printf("\t\t %d ", Student[i].studNo);
			printf("%d", Student[i].regNo.year);
			printf("%c", Student[i].regNo.campus);
			printf("%c", Student[i].regNo.school);
			printf("%c", Student[i].regNo.level);
			printf("%d ", Student[i].regNo.serial_number);
			printf("%c ", Student[i].gender);
			printf("%-10s ", Student[i].student_Surname);
			printf("%-10s ", Student[i].student_givenName);
			printf(": ");
			scanf("%d", &temp_Att);
			while(temp_Att != 1 && temp_Att != 0)
			{
				printf("\n\t\t   You Have Enter Out of Range\n");
				printf("\t\t   Please Re-enter Again\n");
				printf("\t\t\t\t\t\t\t: ");
				scanf("%d", &temp_Att);
			}
			fprintf(AppendingFile, "%d ", temp_Att);
			}
		fprintf(AppendingFile, "\n");
		printf("\n");
		printf("\n\t Do You Want To Continue Mark Attendance(0 to Stop; 1 to Access)? ");
		scanf("%d", &temp_markatt);
		printf("\n\n");
		}while(temp_markatt != 0);

After i do all of my action right,
if i enter '1' to continue to do mark attendance, which mean i can do the second time of making attendance.
but the problem is once i enter '1', it ask me again the question ( Do You Want To Continue Mark Attendance(0 to Stop; 1 to Access)? )
if i enter '1' again.. it giving me non-respond.. must be enter '0'.
what's my code problem ?

Recommended Answers

All 6 Replies

>>but the problem is once i enter '1', it ask me again the question

Because yuou have the question twice in your program, once on line 43 and again on line 56.

i assign them into different variable dude..
and temp_markatt is for the looping; temp_Att is for the user input for the attendance.

nevermind

well could'nt find any problem in your code... its happening maybe because of scanf function...

scanf is shouldn't have problem.. since there have 2 variable hold them already..
i think is the fscanf problem... it might be continues loop after EOF. it dont have return back to the beginning...

May be thats the problem... well you are the better person who can understand your code...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.