اول مشاركه لي فلا تردوني ارجوكم ابحث عن الكود الصحيح لهذا البرنامج حاولت بس ما اظن انه صحيح
اول مشاركه لي فلا تردوني ارجوكم ابحث عن الكود الصح
السلام عليكم ,,
اقتباسحاولت بس ما اظن انه صحيح
ضع الكود وسنساعدك باذن الله ,,
#include<iostream.h>
#include<stdio.h>
// Please read this tow consts
#define STD_NO 5
#define DEG_NO 5
struct student
{
char studentname[10];
char studentsecondname[20];
int test[DEG_NO];
int sum;
float ave;
};
void fillstruct(student record[sTD_NO])
{
int s = 0;
int i, j;
char key =' ';
for(i = 0;i < STD_NO;i++)
{
cout << "display welcome message and how this program work \n\n";
cout << "press any key to countinue\n\n";
cin >> key;
//clrscr();
cout << "student name ";
cin >> record.studentname;
cout << "student second name ";
cin >> record.studentsecondname;
cout << "\nEnter the degree \n\n";
for(j = 0; j < DEG_NO;j++)
{
cout << "Test " << (j + 1) << " ";
cin >> record.test[j];
s += record.test[j];
}
record.sum = s;
s = 0;
record.ave = float(record.sum / DEG_NO);
cout << "\n The next student..." << (i + 1) << endl;
cout << "-------------------------\n\n";
}
}
void printresult(student record[sTD_NO])
{
for(int i = 0;i < STD_NO;i++)
{
cout << record.studentname << "\t" << record.studentsecondname << endl;
cout << "Student's degree : ";
for(int u = 0;u < DEG_NO;u++)
{
cout << record.test << " ";
}
cout << "\nDegree sum : " << record.sum << endl;
cout << "Student's average : " << record.ave << endl;
if (i < (STD_NO - 1))
{
cout << "\n The next student...\n";
cout << "-------------------------\n\n";
}
else
{
cout << "-------------------------\n\n";
}
}
}
void sortstudent(student record[sTD_NO])
{
int i, j;
student TempStudent;
for(i = 0; i < STD_NO; i++)
{
for(j = 0; j < STD_NO; j++)
{
if (record[j].ave < record[j + 1].ave)
{
TempStudent = record[j];
record[j] = record[j + 1];
record[j + 1] = TempStudent;
}
}
}
}
int main()
{
student record[sTD_NO];
// input stage
fillstruct(record);
// sort stage
sortstudent(record);
// print stage
printresult(record);
return 0;
}
where are ur help my friend and teachers
قريبا ان شاء الله سأرد لأنني بصراحة طرحت عدة مواضيع بالمنتدى و بالكاد أستطيع أن أوفق بين دراستي و البرمجة
مدونتي
than i will be waiting
الأخ / الاخت silga
قمت بتنفيذ البرنامج و مراجعته بدقة الا أنني لم أجد فيه خطأ .... و بالفعل حيرتني معاك
اذا كنت تعني أن الخطأ هو في العبارة
press any key to countinue
أي بمعنى أنك تريد أن يضغط المستخدم على أي زر للتنفيذ فيامكانك أن تستخدم التابع
getch() الموجود في الملف الرأسي conio.h
و مع ذلك اذا أردت الدقة أرسل لي رسالة الخطأ التي يعطيك اياها المصرف أو حدد ما الخطأ باضبط
مدونتي
well my friend thanx for helping me but the thing is my problem is not with the code my problem is am using a rong code for the assiment i didnt use a lot wt it requered thr ,eg exit ,and the 4 **** . i will show u my new code chek it for me plz
hellow
هذا الموضوع مغلق.
