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

بليييييز ساعدوني بسرعه لو سمحتوا

بدأه ونـ حزن ـة في 29 ديسمبر 2008 · 5 رد · 543 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

مرحبااا

سوري ما كنت اعرف القوانين ومن حقكم تغلقون الموضوع

المطلوب

Write a program that reads a list of integers from the keyboard and creates the following information:

a) Finds and displays the sum and the average of these integers.

B) Finds and displays the largest of these integers.

c) Finds and displays the smallest of these integers.

d) Displays YES if all of these integers are between 10 and 90 and NO if not.

e) Displays YES if some of these integers are less than 20 and NO if not.

The input data consist of a list of integers with a sentinel (9999). The program must ask the user to enter the integers, one by one, and enter the sentinel when the end of the list has been reached.

The output should appear as follows:

The sum of all these numbers is : -------

The average of all these numbers is : -------

The largest number is --------

The smallest number is --------

All these numbers are between 10 and 90 : ---------------

Some of these numbers are less than 20 : ---------------

وهاذي محاولتي وان شاء الله تعدلون فيها لنها مب ضابطه

بس يطلع لي sum , avg

#include<iostream>

using namespace std;

const int SENTINEL =9999;

int main ()

{

int num, i=0;

cout<<"Enter any integers(9999 to stop)/n";

int sum= 0;

double avg = 0;

cin>>num;

while(num!=SENTINEL)

{

sum= sum+num;

i++;

cin>>num;

}

cout<<"The sum of all these "<< i<<" numbers is :" <<sum<< endl;

if (i!=0)

cout<<"The average of all these numbers is :"<<sum/i<<endl;

int max=0;

int min=0;

cin>> num;

max= num;

for ( i=1; i<num; i++)

{

cin>>num;

if(num<max)

max= num;

else

(num<min);

min=num;

}

cout<<"The largest number is" << max<<endl;

cout<<"The smallest number is" << min<<endl;

if (min>= 10&& max<=90)

cout<<"All these numbers are between 10 and 90 :YES/n";

else

cout<<"All these numbers are between 10 and 90 :NO/n";

if (min<20)

cout<<"Some of these numbers are less than 20 : YES/n";

else

cout<<"Some of these numbers are less than 20 : NO/n";

return 0;

}

مشكوورين ويزاكم الله الف خير

تم تعديل هذه المشاركة بواسطة ونـ حزن ـة في 29 ديسمبر 2008 في 16:50

#2

هذا تعديل بسيط:

  1. #include<iostream>
  2. using namespace std;
  3. int main ()
  4. {
  5. int SENTINEL =9999;
  6. int num, i=0;
  7. cout<<"Enter any integers(9999 to stop)"<<endl;
  8. int largest=0,smallest=9999;
  9.  
  10. int sum= 0;
  11. double avg = 0;
  12.  
  13. while(1)
  14. {
  15. cin>>num;
  16. if(num==SENTINEL) break;
  17. sum+=num;
  18. if(smallest>num) smallest=num;
  19. if(largest<num)largest=num;
  20. i++;
  21. }
  22. cout<<"The sum of all these "<< i<<" numbers is :" <<sum<< endl;
  23. if (i!=0)
  24. cout<<"The average of all these numbers is :"<<double(sum)/i<<endl;
  25. cout<<"The largest number is" << largest<<endl;
  26. cout<<"The smallest number is" << smallest<<endl;
  27.  
  28. if (smallest>= 10&& largest<=90)
  29. cout<<"All these numbers are between 10 and 90 :YES/n";
  30. else
  31. cout<<"All these numbers are between 10 and 90 :NO/n";
  32.  
  33. if (smallest<20)
  34. cout<<"Some of these numbers are less than 20 : YES/n";
  35. else
  36. cout<<"Some of these numbers are less than 20 : NO/n";
  37.  
  38. return 0;
  39. }
  40.  

tvquran_6.gif

#4

مشكوور اخووي ويعطيك العااافيه يارب

تسلم على الرد السريع والله لا هانك

بس ما عليه راح اكلف عليك شوي

تقدر تشوفلي اخر الاكواد لازم يكون كل واحد بسطر مع انه حاطه نيو لاين بس ما ضبط عندي

طلع عندي كلهم بنفس السطر

 if (smallest>= 10&& largest<=90)

 cout<<"All these numbers are between 10 and 90 :YES/n";

 else

 cout<<"All these numbers are between 10 and 90 :NO/n";

 if (smallest<20)

 cout<<"Some of these numbers are less than 20 : YES/n";

 else

 cout<<"Some of these numbers are less than 20 : NO/n";
#5

فقط العلامة مقلوبه

  1. n
  2.  

tvquran_6.gif

#6

مشكوور وما قصرت اخووي

عساك ع القوه

وربي ما انتبهت انها مقلوبه العتب ع النظر

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

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

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

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

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