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

للعضو نفسي أفهم ..

مغلق
بدأه maithah في 28 أكتوبر 2003 · 2 رد · 478 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

ممكن تحل لي هالمسالة؟؟؟

Write a C++ program that reads name and score of a class of 20 students and displays the following:

a. Number of students whose scores are between 85 and 100

b. Number of students whose scores are less than 65

c. The average score of all the students

#2

#include<iostream>

#include<string>

using namespace std;

int main()

{

int count=1;

string name;

int score;

int count1=0;

int count2=0;

float sum=0;

float average;

cout<<" enter the name and score of student# "<<count<<endl;

cin>>name>>score;

while(count<20)

{

sum= sum+score;

if((score>85) && (score<100))

count1++;

else if(score<65)

count2++;

count++;

cout<<" enter the name and score of student# "<<count<<endl;

cin>>name>>score;

}

average =sum/20.0;

cout<<"Number of students whose scores are between 85 and 100 is"<< count1<<endl;

cout<<"Number of students whose scores less tha65"<< count2<<endl;

cout<<" tha average ="<< average;

return 0;

}

#3

أخوي........حبيت أسأل السؤال هب كان واضح....قالوا فيه انه يقرا فكيف دخلت البيانات من ال keyboard و في السؤال يطلب منك أنك تقرا من الفايل...؟؟؟؟

أرجوكم خبروني الجواب..لأني يوم حليت السؤال حليته على اساس أنه reading from file

و أنا حليت بها الطريقة..

#include<iostream>

#include<fstream>

#include<string>

using namespace std;

int main()

{

int count=0,total=0;

int num,num1=0,num2=0;

float average;

ifstream infile;

string name;

infile.open("studentscore.txt");

infile>>name >>num;

while(infile)

{

total=total+num;

if((num>=85) && (num<=100))

num1++ ;

else if(num<65)

num2++;

infile>>name >>num;

}

cout<<" the number of students whose scores are btween 85 and 100 is "<<" "<<num1<<endl;

cout<<" the number of students whose scores are less than 65 is"<<" "<<num2<<endl;

average=total/20;

cout<<" the average of all students is"<<" "<<average<<endl;

return 0;

}

يالله أخوي خبرني.......

تم تعديل هذه المشاركة بواسطة طالبه في 29 أكتوبر 2003 في 00:16

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

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