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

الله يخليكم سااعدوني :(

مغلق
بدأه المهاء في 17 أكتوبر 2003 · 3 رد · 677 مشاهدة · في ارشيف قسم C/C++
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

Write a program that will print the averages for several student records. each record contains a student ID and three test grades. if a test grade is missing a -1 is inserted. The record is invalid...Read each record, print the test scores, and the student average. write the record out with the average. At bottom of report, print the class average under each test and the final grades. **( Format the avareges to 1 decimal place.

Write the report to the file ''Report.dat''.

Must USE FUNCTIONS.YOU MAY NOT USE GLOBAL VARIABLES.

Methodology:

Open the data file ''student.dat'' and test to make sure the file is there. Set up a while loop to read each record until eof

Print the record.

Determine if the record is vaild

If not, print a message

If it is, compute and print the average of the tests for the student. Add the test scores to the class total and add one to the class count.

Print the class avarages.

Data File

12345 90 80 60

34567 -1 60 50

23456 70 60 90

33333 100 -1 80

43211 70 77 78

43567 80 80 81

87887 100 90 -1

98787 100 100 100

Improtant:

Your code must be properly indented and documented to be accepted. Dont put comments on tthe same line as code.

---

ملاحظه المدرسه اعطتناا برناامج اسمه Sample Program

مرتبط بالبرناامج اللي فوق او مرتبط به والسميل بروقرام هو :

/ **************************************************

**

Name:

Other Comments:

**************************************************

*/

//this is another comment

#include

#include

using namespace std;

void main (void)

{

ifstream input;

int id;

int grade1, grade2, grade3;

//open the file

input.open ("students.dat");

//make sure you opened the file

if (! input.good ())

{

cout<< "Input file not found";

exit (1);

}

//read the file. Print the output to the screen

while ( input >> id )

{

cout<< endl << "Student Id: " << id;

input >> grade1;

cout << " Grade 1:" << grade1;

input >> grade2;

cout << " Grade 2:" << grade2;

input >> grade3;

cout << " Grade3:" << grade3;

cout << " Average: " << grade1 + grade2 + grade3 / 3;

}

cin >>id;

}

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

انا سااعدني احد الاخوه في البرنااامج في احد المنتدياات الاخرررى بسس بصررراحه مدري ايش الساالفه والبرنامج هو كالتاالي مع وجود بعض الاخطااء ارجوا تصحيحهااا:

#include

#include

struct studentRec{

int id;

int a,b,c;

};

float sAvg(studentRec s);

bool isValid(studentRec s);

void outPut(studentRec s,ofstream *out);

int main(){

ifstream in;

ofstream out;

in.open("in.dat",ios::binary);

out.open("out.txt");

if (!in){

cout<<"canot open the file";

return 1;

}

out.precision(3);

studentRec s;

int count=0;

int t1,t2,t3;

t1=t2=t3=0;

while(in){

count++;

in>>s.id>>s.a>>s.b>>s.c;

if (s.a>0)t1+=s.a;

if (s.b>0)t2+=s.a;

if (s.c>0)t3+=s.a;

outPut(s,&out);

}

t1=t1/count;

t2=t2/count;

t3=t3/count;

out<<" \n************************************************

********************************\n";

out<<"test 1 avg= "< *out< }

float sAvg(studentRec s){

float a=0;

if (s.a>0) a+=s.a;

if (s.b>0) a+=s.b;

if (s.c>0) a+=s.c;

return (a/3);

}

-------

ولماا دزيته للمدرسه قالتلي ماافيه Doucomentation

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

اختكم المها

#2

وينكم ياناسس :(

#3

هل من توضيح مع ملاحظة أن المنتدى ليس لحل الوظائف الدرسية

مدونتي

http://mbnoimi.net

#4

آسفه اخوي

بس تبي توضيح من اي نااحيه

انا ابي البرنامج اللي سويته يطبع ال average حق الطلاب اللي في داتا فاايل الموجود ارقاامه فوووق

ووووويعطيك الف عاافيه راح اكون ممنونه لك

وراح ادعيلك ان شالله :)

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

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