final report cse101
final report cse101
CALCULATOR
Computer Programming
(CSE 101)
Report For Project
Roll No: - 17
Group Members:-
1
Introduction: -
The Student Attendance Calculator is a simple
C program that allows users to manage
student attendance records. The program uses
an array of structures to store student details
such as email, registration number, course,
total lectures, and lectures attended. The
program provides a menu-driven interface for
users to add new students, display all
students, search for a student by registration
number, and modify student details.
The student attendance calculator is designed
to be a console-based program. It uses simple
user interface that allows users to enter the
attendance details of each student. The
program consists of several modules,
including the main function, input module,
output module, and calculation module.
2
Module Explanation: -
Modify Student Details [void modify( )]: -
3
Display detail of student[void displayList ( )]: -
4
Code: -
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct student {
char name[20];
int roll_no;
int attendance;
};
int main() {
FILE *fp;
struct student s;
int option;
while (1) {
printf("\tSTUDENT ATTENDANCE CALCULATOR\t");
printf("\n\t\t1. ADD STUDENT");
printf("\n\t\t2. DELETE STUDENT");
printf("\n\t\t3. MODIFY STUDENT");
printf("\n\t\t4. DISPLAY STUDENT LIST");
printf("\n\t\t5. Search Record");
printf("\n\t\t0. EXIT");
switch (option) {
case 0:
return 1;
break;
case 1:
5
add(fp);
break;
case 2:
fp = del(fp);
break;
case 3:
modify(fp);
break;
case 4:
displayList(fp);
break;
case 5:
searchRecord(fp);
break;
default:
printf("\nInvalid Option");
printf("\nProgram terminated");
exit(0);
}
}
return 1;
}
fseek(fp, 0, SEEK_END);
rewind(fp);
fclose(fp);
fclose(ftmp);
remove("attendance.txt");
rename("tmpfile", "attendance.txt");
return fp;
}
rewind(fp);
rewind(fp);
printf("\nName\tRoll No\tAttendance\n");
while (fread(&s, sizeof(s), 1, fp) == 1) {
printf("%s\t%d\t%d\n", s.name, s.roll_no, s.attendance);
}
}
rewind(fp);
if (!found)
printf("\nRecord Not Found\n");
}
8
Output Snapshots:
1.Add Student:-
9
2. Delete Student:-
10
3. Modify Student:-
11
4. Display Student List
12
5. Search Record
13
6. Exit Code:-
14