// تعريف الكلاس Student
class Student {
private:
String name;
int attendance[5]; // حالة الحضور (1: حاضر، 0: غائب) لكل محاضرة
public:
// (Constructor) لتحديد اسم الطالب
Student(String studentName) {
name = studentName;
for (int i = 0; i < 5; i++) {
attendance[i] = 0; // جميع المحاضرات غياب
}
}
// لتسجيل حضور لمحاضرة معينة
void markAttendance(int lectureNumber) {
if (lectureNumber >= 0 && lectureNumber < 5) {
attendance[lectureNumber] = 1; // تسجيل الحضور
}
}
// لحساب عدد مرات الحضور
int getAttendanceCount() {
int count = 0;
for (int i = 0; i < 5; i++) {
count += attendance[i];
}
return count;
}
// لطباعة النتيجة
void printAttendance() {
Serial.print("Student Name: ");
Serial.println(name);
Serial.print("Total Attendance: ");
Serial.println(getAttendanceCount());
Serial.println("--------------------");
}
};
// اسماء الطلاب
Student student1("Tasneem");
Student student2("samy");
Student student3("abdulmonem");
void setup() {
Serial.begin(9600);
// تسجيل حضور الطلاب
student1.markAttendance(0); // tasneem حضر المحاضرة الأولى
student1.markAttendance(1); // tasneem حضر المحاضرة الثانية
student1.markAttendance(3); // tasneem حضر العملي
student2.markAttendance(0); // samy حضر المحاضرة الأولى
student2.markAttendance(2); // samy حضر المحاضرة الثالثة
student2.markAttendance(4); // samy حضر الـ Workshop
student3.markAttendance(1); // abdulmonem حضر المحاضرة الثانية
student3.markAttendance(2); // abdulmonem حضر المحاضرة الثالثة
student3.markAttendance(3); // abdulmonem حضر العملي
student3.markAttendance(4); // abdulmonem حضر الـ Workshop
// طباعة الحضور لكل طالب
student1.printAttendance();
student2.printAttendance();
student3.printAttendance();
}
void loop() {
}