السلام عليكم ورحمة الله
أنا طالبة جديده
أعطتني الإستاذه مشروع
وربي أربعة أيام أفكر فية وحااااولت وبأنزل محاولتي
بس البرنامج فية أخطاء أبغاكم تساعدوني شوي ...^-*
Mid-term Project
Write a C++ program to read, save, sort, search and display the students’ ids, student names and marks of N students.
محاولتي >> أحسها خطأ ههههه
#include<iostream>
#include <string>
using namespace std;
struct stud
{
string name;
int id;
float mark;
};
int main()
{int x ,i;
struct stud z[7];
cout<<" 1. Clear"<<endl;
cout<<"2. Register a Student (Id, Name, Mark)"<<endl;
cout<<"3. Display the student with a highest mark"<<endl;
cout<<"4. Display the marks of all students"<<endl;
cout<<"5. Display the percentage of the total mark received by each student"<<endl;
cout<<"6. Sort all marks in ascending order"<<endl;
cout<<"7. Sort all marks in descending order"<<endl;
cout<<"8. Search for a student with a given id"<<endl;
cout<<"9. Search for a student with a given name"<<endl;
cout<<"10. Search for a student with a given mark"<<endl;
cout<<"11. Exit"<<endl;
cout<<"select anumber"<<endl;
cin>>x;
switch (x)
{
case 1:
cout << "Clear" ;
break;
case 2:
cout << "Register a Student (Id, Name, Mark)"<<endl;
for (i=0 ;i<7;i++)
{
cout<<"enter the name"<<endl;
getline(cin,z.name);
cout<<"enter the ID"<<endl;
cin>>z.id;
cout<<"enter the mark"<<endl;
cin>>z.mark;
}
break;
case 3:
cout << "Display the student with a highest mark";
for (i=0 ;i<7;i++)
{
if (z.mark>z[i+1].mark)
cout<<z.mark;
cout<<z.name;
cout<<z.id;
}
break;
case 4:
cout << "Display the marks of all students";
break;
case 5:
cout << "Display the percentage of the total mark received by each student";
break;
case 6:
cout << "Sort all marks in ascending order";
break;
case 7:
cout << "Sort all marks in descending order";
break;
case 8:
cout << "Search for a student with a given id";
break;
case 9:
cout << "Search for a student with a given name";
break;
case 10:
cout << "Search for a student with a given mark";
break;
default:
cout << "Exit
}
cout << endl;
return 0;
}
ويعطيكم العافية >>>
وربي مره مستعجلة لأن التسليم السبت القادم
أتمنى أحد يشرح لي
والله يوفقة يارب ويسعده في الدارين