الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مساله

مغلق
بدأه طالب برمجة في 23 ديسمبر 2003 · 4 رد · 561 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

ياريت اللي عنده فكره عن الحل يجاوبني

Write a C++ program to read the contents of the above file in suitable arrays and display the following:

AAA 90 85 91 95 92

BBB 84 80 81 82 75

CCC 91 92 70 75 95

DDD 70 80 75 85 60

EEE 80 79 78 76 82

FFF 75 65 85 60 76

1.The maximum score of each student and at which exam number he/she got it.

2.The minimum score of each student and at which exam number he/she got it.

3.The average score of each student

4.The maximum score of each exam and who got it.

5.The minimum score of each exam and who got it.

6.The average score for each exam

7.The overall average score of the class

#2

أخويه هذا الحل....وإن شاء الله تفهمه...

kj.cpp

#3

مشكوره اختي ......

مشاء الله عليج....... اللهع يوفقج إن شاء الله

#4

بس المطلوب بس السؤال يطلع الشكل الخارجي:

Student Name Maximum Exam# Minimum Exam# Average

=========================================================

AAA 95 4 85 2 90.6

BBB

CCC

DDD …………………………………………………………

EEE

FFF

Exam# Maximum St.Name Minimum St.Name Average

=========================================================

1 91 CCC 70 DDD 81.67

2

3 …………………………………………………………

4

5

The overall average = 80.1333

#5

السلام عليكم...أخويه هذا الحل....

#include<iostream>

#include<fstream>

#include<string>

int max = 0;

int min = 1000;

int max_num;

int min_num;

int sum = 0;

using namespace std;

int main()

{

string n, r;

float a;

float Q = 0;

string name[6];

int exam[6][5],i,m;

ifstream infile;

ofstream outfile;

infile.open("scores.txt");

if(!infile)

{

cout<<"Cannot open file\n";

return 1;

}

cout<<"Name Exam 1 Exam 2 Exam 3 Exam 4 Exam 5"<<endl;

cout<<"==============================================="<<endl;

for( m=0; m<6 ; m++)

{

infile>>name[m];

cout<<name[m]<<"\t";

for( i = 0; i<5 ;i++)

{

infile>>exam[m];

cout<<" "<<exam[m]<<" ";

}

cout<<endl;

}

cout<<endl<<endl;

cout<<"Student Name"<<" "<<"Maximum"<<" "<<"Exam#"<<" "<<"Minimum"<<" "<<"Exam#"<<" "<<"Average"<<endl;

cout<<"=============================================================="<<endl;

for( m=0; m<6 ; m++)

{

cout<<name[m]<<"\t";

for( i = 0; i<5 ;i++)

{

if( exam[m] > max)

{

max = exam[m];

max_num = i;

}

if( exam[m] < min)

{

min = exam[m];

min_num = i;

}

sum = sum + exam[m];

}

a = sum/5.0;

cout<<" "<<max<<" "<<max_num+1<<" "<<min<<" "<<min_num+1<<" "<<a<<endl;

max = 0;

min = 100;

sum = 0;

Q = Q + a;

}

cout<<endl<<endl;

cout<<"Exam# Maximum St.Name Minimum St.Name Average"<<endl;

cout<<"=============================================================="<<endl;

for( i=0; i<5 ; i++)

{

for( m=0; m<6 ;m++)

{

if( exam[m] > max)

{

max = exam[m];

n = name[m];

}

if( exam[m] < min)

{

min = exam[m];

r = name[m];

}

sum = sum + exam[m];

}

cout<<" "<<i+1<<" "<<max<<" "<<n<<" "<<min<<" "<<r<<" "<<sum/6.0<<endl;

max = 0;

min = 100;

sum = 0;

}

cout<<endl<<endl;

cout<<"The overall average ="<<Q/6.0<<endl;

infile.close();

return 0;

}

والسموحه....

هذا الموضوع مغلق.

مواضيع مشابهة