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

مسالة حياة او موت .....بليييييييييييييييييز الرجاع المساعده

مغلق
بدأه النور في 18 ديسمبر 2002 · 2 رد · 595 مشاهدة · في ارشيف قسم C/C++
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

والله انا اسفه على هذا الموضوع اللي راح اكتبه لاني قريت شو شروط التسجيل في المنتدى بس والله لولا حاجتي ما لجئت لكم والله ........

الله يخليكم لين اهلكم ان شاء الله بليييييييز ساعدوني اكتب هذا البرنامج والله انه عندي امتحان ومااروم اسوي اي شي غير اني اذاكر ومطلوب اني اسلم هذا البروجرام يوم الجمعه فبليييز المساعده والله بتسوون فيني خير والله....

هذا هو البرنامج والله اني ما عرفت اسويه بس هو اكيد سهل بالنسبه لكم لانكم مبرمجين كبار ..بس انا للحينه بروجرام1 ....يعني بداية الدرب والله بلييييييييز ساعدوني بليييييييييز

وهذا هو البرنامج..

______________________________________...

this is my email (bentelnor@hotmail.com)

this is the program ...

--------------------------------

________________________________________

Programming I (ITBP120)

Fall 2002

Extra Credit HW#1

There are 5 students in section 01. They have 4 courses which are

Programming-I, Business, Probability and Hardware1.

You required to design an application/program with the following functionality:

1. Get user input for 5 students (Name, ID, scores for the above

mentioned courses, (see below for the data in the in put file)From an

input file that you create and store data in prior to this program.

2. In an output file, that the program will create, for each student you

. need to display the following:

student name ID average score

----------------- --------- -----------

Khaled 123 75

Ali 345 80

. The program must prompt the user to input the name of an input file and the

name of an output file

. In the output file write the overall average of the class, the maximum and

minimum average.

. The list must be sorted in an increasing order according to the average score of

the students.

. If the average of two or more students is the same then sort them by their IDs

in a decreasing order.

. The program must make sure that there is no division by zero and that the

average computed is greater than zero and less than or equal to 100 for any

student.

. The program must check for negative values and must replace any negative

value by its absolute value.

. The input file will contain the following data (when you read the data make

sure that you ignore the first two lines) .

. The program must check for end of file condition.

data In the Input file:

Student name ID Business Programming Probability Hardware 1

--------------------- ----- ----------- ---------------- ------------- ------------

Ali 345 80 80 90 70

Sameera 001 90 80 90 80

Huda 090 0 0 0 0

Mona 080 90 80 87 98

Ahmed 980 80 98 -87

#2

هذا البرنامج لا يرتب الخرج حسب المعدل

#include

#include

#include

#include

struct student

{

char *student_name;

int mark[4];

int ID;

int average;

} s[5];

void read_one_line(FILE *in_file,char *name, int &ID, int *mark)

{

fscanf(in_file,"%s ",name);

fscanf(in_file,"%d ",&ID);

for (int i = 0; i < 4; i++)

fscanf(in_file,"%u ",&mark);

// fscanf(in_file,"%c",'n');

}

void set_one_student(int index,char *name,int ID,int *mark)

{

s[index].student_name = new char[strlen(name)+1];

strcpy(s[index].student_name,name);

s[index].ID = ID;

for (int i = 0; i < 4; i++)

s[index].mark = abs(mark);

}

void read_input(char *input_file)

{

FILE *in_file_ptr;

char *name;

int mark[4];

int ID, index = 0;

name = new char;

if ((in_file_ptr = fopen(input_file,"r")) == NULL) {

cout << input_file << " not openedn";

exit(1);

}

fseek(in_file_ptr,0L,SEEK_SET);

while (!feof(in_file_ptr)) {

read_one_line(in_file_ptr,name,ID,mark);

set_one_student(index,name,ID,mark);

index++;

}

fclose(in_file_ptr);

}

void calc_average()

{

int ave = 0;

for (int j = 0; j < 5; j++){

ave = 0;

for (int i = 0; i < 4; i++)

ave += s[j].mark;

ave /= 4;

s[j].average = ave;

}

}

void write_output(char *output_file)

{

int j;

FILE *out_file_ptr;

out_file_ptr = fopen(output_file,"w");

for (j = 0; j < 5; j++) {

fprintf(out_file_ptr,"%s ",s[j].student_name);

fprintf(out_file_ptr,"%d ",s[j].ID);

fprintf(out_file_ptr,"%dn",s[j].average);

}

fclose(out_file_ptr);

}

void main()

{

char *input_file;

char *output_file;

input_file = (char*)malloc(20);

output_file = (char*)malloc(20);

cout << " Enter input file "; cin >> input_file;

cout << " Enter output file "; cin >> output_file;

read_input(input_file);

calc_average();

write_output(output_file);

free(input_file);

free(output_file);

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

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

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…