[TABLE="align: right"]
[TR]
[TD]
[/TD]
[/TR]
[/TABLE]
Part#1: Lab Exercise
Write a C++ program that includes the following functions:
1. A function named sortList that takes as parameters: an array of double and the array size. The function should sort the numbers in a descending order. Use selection sort algorithm.
2. A function named readList that takes as parameters: an array of double and the array size. The function should prompt the user to input the array data.
3. A function named printList that takes as parameters: an array of double and the array size. The function should display the elements of the array.
4. A function named print topFive that takes as parameters: an array of double and the array size. The function should print the largest five numbers in the array. Hint: you have to sort the array first.
Write a main program that prompts the user to enter his ID, name and 10 double numbers representing his quiz grades of ITCS104. Using the above functions, the program should generate a report as follow:
[TABLE="align: center"]
[TR]
[TD]Sample Input/Output:
[/TD]
[/TR]
[TR]
[TD]
Enter Student ID: 20081234
Enter Student Name: Student1
Enter quiz grades: 1.5 2.5 6.5 4.5 10 9 8 7 3.5 5.5
Report
ID: 20081234
Name: Student1
Grades (descending): 10 9 8 7 6.5 5.5 4.5 3.5 2.5 1.5
Top 5 grades: 10 9 8 7 6.5
[/TD]
[/TR]
[/TABLE]
Part#2: Home Assignment
Complete the previous exercise to include the following functions:
1. A function named computeAverage that takes as parameters: an array of double and the array size. The function should calculate and return the average of the double numbers in the array.
2. A function named displayAboveAverage that takes as parameters: an array of double and the array size. The function should display the numbers in the array that are above the average. Hint: call computeAverage to find the average of the numbers.
3. A function named countGrade that takes as parameters: an array of double, the array size, a double value (oldValue), and a double value (newValue). The function should replace each occurrence of the oldValue by the newValue.
Write a main program to test your functions.
ممكن فقط شرح طريقة السؤال؟؟!!
Write a C++ program that includes the following functions:
1. A function named sortList that takes as parameters: an array of double and the array size. The function should sort the numbers in a descending order. Use selection sort algorithm.
نسوي فنكشن sortlist تاخذ باراميتر ( أرري نوعها double ، السايز مال الأرري نوعه int ) الفنكشن لازم ترتب العناصر تنازليا من الأكبر للاصغر باستخدام selection sort method
2. A function named readList that takes as parameters: an array of double and the array size. The function should prompt the user to input the array data.
نسوي فنكشن تطلب من اليوزر
3. A function named printList that takes as parameters: an array of double and the array size. The function should display the elements of the array.أن يدخل بيانات للأرري ، يعني كلما يدخل رقم نخزنه في بوزيشن ونروح للبوزيشن اللي بعده ..
4. A function named print topFive that takes as parameters: an array of double and the array size. The function should print the largest five numbers in the array. Hint: you have to sort the array first.
فنكشن تطبع أول أكبر 5 أرقام في الأرري ، بس قبل لازم نرتبهم تصاعديا او تنازليا ، لو رتبناهم تصاعديا راح نبدي من الأخير ونرجع بالبوزيشن 4 مرات فقط
اما اذا كان تنازلي الترتيب فنقدر نبدأ من البداية ونطبع أول 5 فقط ، لاحظي أن عندنا فنكشن sortlist تسوي هالشغلة فنسوي ليها كول هني اول تالي نطبع أول 5
Write a main program that prompts the user to enter his ID, name and 10 double numbers representing his quiz grades of ITCS104. Using the above functions, the program should generate a report as follow:
نطلب من اليوزر في المين يدخل لينا ID , name و 10 أرقام من نوع double يعبرون عن درجات كويزاته في مقرر ITCS104
بإستخدام هالمعلومات ، البرنامج لازم يطلع output بهالشكل :
Sample Input/Output:
Enter Student ID: 20081234
Enter Student Name: Student1
Enter quiz grades: 1.5 2.5 6.5 4.5 10 9 8 7 3.5 5.5
Report
ID: 20081234
Name: Student1
Grades (descending): 10 9 8 7 6.5 5.5 4.5 3.5 2.5 1.5
Top 5 grades: 10 9 8 7 6.5
Part#2: Home Assignment
Complete the previous exercise to include the following functions:
1. A function named computeAverage that takes as parameters: an array of double and the array size. The function should calculate and return the average of the double numbers in the array.
نسوي فنكشن تطلع لينا الأفرج مال الدرجات في الأرري
2. A function named displayAboveAverage that takes as parameters: an array of double and the array size. The function should display the numbers in the array that are above the average. Hint: call computeAverage to find the average of the numbers.
نسوي فنكشن تطبع لينا الدرجات اللي أعلى من الأفرج ، يعني اول لازم نسوي call للفنكشن القبلية عشان نحسب الأفرج بعدين نجيك اذا الدرجاة أكبر من الأفرج نطبعها
3. A function named countGrade that takes as parameters: an array of double, the array size, a double value (oldValue), and a double value (newValue). The function should replace each occurrence of the oldValue by the newValue.
نسوي فنكشن تستقبل 2 باراميتر ( درجة قديمة ، درجة جديدة ) نوعهم double
الفنكشن لازم تبحث عن الدرجة القديمة في الأرري ، واذا حصلتها تاخذ الدرجة الجديدة وتحطها مكانها .. مثل الـ makeup quiz يعني
Write a main program to test your functions.
سوي مين تختبرين فيه كل الفنكشنز اللي سويتينهم ..