بالإضافة إلي ما تم تصحيحه بواسطة علامات تعجب
في الفنكشن sort
نسيت الأقواس
كود:[B][B] [COLOR=#000080] if (arr[i].pos >[/COLOR] arr[i+1].pos) temp=arr[i]; arr[i]=arr[i+1]; arr[i+1]= temp; [/B][/B]
لازم تكتبها
كود:[B][B] [COLOR=#000080] if (arr[i].pos >[/COLOR] arr[i+1].pos) { temp=arr[i]; arr[i]=arr[i+1]; arr[i+1]= temp; } [/B][/B]
بالإضافة إلى إن في الفنكشن read في بيانات ناقصين ما خليته يقرأهم
و في الفنكشن برنت خليته يطبعهم .
لازم تخليه يقرأ البيانات كلها في الـ read بعدين تستعملها
عشان ما يعطيك البرنامج نواتج خطأ
في المين فنكشن ناقص
return 0;
بالتوفيق ..
شكرا اخوي اكو خليتهم بس مثل الشئ
يصير بعد الكول فكشن اكتب سي اوت

-

ليش تكتب سي أوت ؟؟
المفروض تشغل البرنامج
بينتظرك تدخل البيانات للعمال (20 عامل )
بعدين برتبهم و بيطبعهم
تقصد إن يطلع لك إرور بعد؟؟

لا مايطلع ايرور بس اقصد ان ندخل ID بعد ؟؟ كنت ابي اسأل اشلون نجرب البرنامج![]()
في المين فنكشن ناقصبالإضافة إلى إن في الفنكشن read في بيانات ناقصين ما خليته يقرأهم
و في الفنكشن برنت خليته يطبعهم .
لازم تخليه يقرأ البيانات كلها في الـ read بعدين تستعملها
عشان ما يعطيك البرنامج نواتج خطأ
في المين فنكشن ناقص
return 0;
ماا فهمت وش قصدك ممكن توضح
return 0;

شكراً m.g.s ،،
![]()
#include<iostream>
using namespace std;
struct datetype
{
int day ;
int month;
int year;
};
struct StudentType{
int studentId;
datetype birthdate;
double marks[36];
int nbc;
};
double CalAvr(StudentType X)
{
double totalmarks=0;
double average;
for (int i=0;i<X.nbc;i++)
{totalmarks=totalmarks+X.marks[i];
average=totalmarks/X.nbc;
}
return average;
}
void printstudent(StudentType X)
{
cout<<X.studentId<<" "<<X.birthdate
for (int j=0;j<X.nbc;j++)
cout<<X.marks[j]<<endl;
cout<<"your average"<<endl;
cout<<CalAvr(X);
}
int BestStudent(StudentType S[], int size)
{
for (int i=0;i<size;i++)
}
Chap11 lab2
1. Write a definition of a struct named DateType, which includes 3 data members as follows:
The data members are:
1. Day with type integer
2. Month with the type integer
3. Year with the type integer
2. Write a definition of a struct named SudentType, which includes data members as follows:
The data members are:
studentId: integer
Student Birthdate: DateType.
Array of marks of the max-size equal 36: double
The number of taken courses (nbc): integer
2. Write the code for the following functions:
CalculateAvr which will calculate the average for a variable of type studentType and
return it
.printStudent which will print the student personal information in one line, followed by all marks that he/she has been taken, ended with average
.BestStudent that receives an array of studentType and its size. The function returns the index of the best student (call function CalculateAvr).
3. Write a main function to test your struct .
Declare an array S[40] of type struct SudentType
.2) Read Personal Information of 3 students into S
Output the ID of the best student (use function BestStudent)
.Print all data of the 3 students.

bestStudent فنكشن مثل maxاول فنكشنين اوكي عرفت لهم و المين فنكشن بعد سهلة بسويها عقب بس الفنكشن الثالث البيست ستودينت ماعرفت لها
ممكن احد يقول شلون نسويها
int bestIndex = 0;
for( i = 1 ... size )
{
avg1 = CalculateAvr(studentList[ i ]);
avg2 = CalculateAvr(studentList[ bestIndex ]);
if( avg1 > avg2)
bestIndex = i;
}
return bestIndex;
return studentList [bestIndex] ;