Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
March 2010 best-students (try 1) write a program that reads integer marks for 10 students. then print how many of these marks are greater than or equal to their average. enter 10 marks: 8 # include <iostream> average: 6.1 using namespace std ; best students: 5 4 7 9 10 4 5 6 3 int main ( ) { int x , i , sum = 0, count = 0 ; هل هذا الحل صحيح؟ count? وكم ناتج double avg; cout << "enter 10 marks: " ; for (i = 1; i <= 10 ; i++) { cin >> x ; sum += x ; } avg = sum / 10.0 ; cout << "average: " << avg << end l; if (x >= avg) count ++; ال تطعن في ذوق فأنت أحد،زوجتك اختياراتها cout << "best students: " << count << end l; return 0; } ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 best-students (try 2) write a program that reads integer marks for 10 students. then print how many of these marks are greater than or equal to their average. # include <iostream> using namespace std; enter 10 marks: 8 average: 6.1 best students: 5 4 7 9 10 4 5 6 3 int main ( ) { int x , i, sum = 0, count = 0; double avg ; cout << "enter 10 marks: "; for (i = 1; i <= 10; i++) { cin >> x; هل هذا الحل صحيح؟ count? وكم ناتج sum += x; } avg = sum / 10.0; cout << "average: " << avg << end l; for (i = 1; i <= 10; i++) if (x >= avg) count++; ال تطلب الفتاة من الدنيا إال زوجا فإذا جاء طلبت منه كل )شئ (شكسبير cout << "best students: " << count << end l; return 0 ; } ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 best-students (try 3) write a program that reads integer marks for 10 students. then print how many of these marks are greater than or equal to their average. # include <iostream> using namespace std; enter 10 marks: 8 average: 6.1 best students: 5 4 7 9 10 4 5 6 3 int main ( ) { int x, i, sum = 0, count = 0; double avg; cout << "enter 10 marks: " ; هل هذا الحل صحيح؟ count? وكم ناتج for (i = 1; i <= 10; i++) { cin >> x; sum += x; if (x >= avg) count ++; } avg = sum / 10.0; cout << "average: " << avg << end l; cout << "best students: " << count << end l; يختبر الذهب بالنـــار وتختبر المرأة بالذهب ويختبر الرجل بالمرأة )(فيلسوف return 0; } ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 best-students (try 4) write a program that reads integer marks for 10 students. then print how many of these marks are greater than or equal to their average. # include <iostream> enter 10 marks: 8 using namespace std; average: 6.1 best students: 5 4 7 9 10 4 5 6 3 int main ( ) { int x, i, sum = 0, count = 0 ; double avg; cout << "enter 10 marks: "; for (i = 1; i <= 10; i++) { هل هذا الحل صحيح؟ ؟count وكم ناتج cin >> x ; sum += x ; avg = sum / 10.0; if (x >= avg) count ++; } cout << "average: " << avg << end l; i x sum avg 1 8 8 0.8 2 5 13 1.3 3 4 17 1.7 4 7 24 2.4 5 9 33 3.3 6 10 43 4.3 7 4 47 4.7 8 5 52 5.2 9 6 58 5.8 10 3 61 6.1 count cout << "best students: " << count << end l; إن لم تزد شيئا على الدنيا كنت أنت زائدا عليها )(مصطفى صادق الرافعي return 0; } ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 best-students (correct-answer) write a program that reads integer marks for 10 students. then print how many of these marks are greater than or equal to their average. # include <iostream> using namespace std; int main ( ) { enter 10 marks: 8 average: 6.1 best students: 4 5 4 7 9 10 4 5 6 3 x int x [10], i, sum = 0, count = 0; 8 0 double avg ; 5 1 4 2 7 3 9 4 10 5 4 6 5 7 6 8 cout << "enter 10 marks: "; for (i = 0; i < 10; i++) { cin >> x [i]; sum += x [i]; } avg = sum / 10.0; cout << "average: " << avg << end l; for (i = 0; i < 10; i++) if (x [i] >= avg) count ++; cout << "best students: " << count << end l; return 0; ... الحياااة ممااامرة جرئيااة )أو ال شيء (هيلين كيلر } ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م 3 9 March 2010 1-D arrays (print-reverse) write a program that reads 10 integers. Then print them in a reverse order. (2 KD) # include <iostream> using namespace std; enter 10 integers: 2 1 5 -7 8 10 3 4 6 17 printing reverse: 17 6 4 3 10 8 -7 5 1 2 int main ( ) { أغلااااب ماااان أخف ااااوا لاااام يكوناااااوا يااااادركوا ماااااد قربهم من النجاح عنادما أعلنوا استسالمهم ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 1-D arrays with functions (sum-evens) write a function that gets an integer array and its number of elements. the function should return the sum of even elements in the array. (2 KD) # include <iostream> using namespace std; enter 10 integers: 2 1 sum evens is: 30 5 7 8 10 3 4 9 6 int sum_evens (int [ ], int); int main ( ) { int x [10], i, sum; cout << "enter 10 integers: "; for (i = 0; i <= 9; i ++) cin >> x [i]; sum = sum_evens (x, 10); cout << "sum evens is: " << sum << end l; return 0; } int sum_evens (int x [ ], int n) { إمااا أن تتعااب لتحصاال أو،علاااااى ماااااا تحاااااب سااااتجبر نفسااااك علااااى حب ما تحصل عليه ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 1-D arrays with functions (average-odds) write a function that gets an integer array and its number of elements. the function should return the average of odd elements in the array. (2 KD) # include <iostream> using namespace std; enter 10 integers: 2 3 average odds is: 5.40 5 7 8 10 3 4 9 6 int main ( ) { int x [10], i; cout << "enter 10 integers: "; for (i = 0; i < 10; i ++) cin >> x [i]; cout << "average odds is: " << avg_odds (x, 10) << end l; return 0; } قدرات كل شخص حسب الحدود التي يضعها لنفسه ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 1-D arrays with functions (average) write a function that gets an integer array and its number of elements. the function should return the average of the array elements. (2 KD) # include <iostream> using namespace std; enter 10 marks: 3 average: 6.1 5 4 7 9 10 4 5 6 8 int main ( ) { int x [10], i; cout << "enter 10 integers: "; for (i = 10; i >= 1; i--) cin >> x [i-1]; cout << "average: " << average (x, 10) << end l; return 0; قرر أن تكون األفضل ستصبح األفضل } ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 1-D arrays with functions (search-key) write a function that gets an array, its number of elements and a key. the function should return true if key exists in the array, false otherwise. (2 KD) enter 7 numbers: 2.5 1.7 7.2 15.5 17.8 7.2 1.1 enter the search key: 17.8 # include <iostream> existing using namespace std; enter 7 numbers: 2.5 1.7 7.2 15.5 17.8 7.2 1.1 enter the search key: 3.6 not existing int main ( ) { double x [7], key; cout << "enter 7 numbers: "; for (int i = 6; i >= 0; i --) cin >> x [i]; cout << "enter the search key: "; cin >> key; if ( search (x, 7, key) == true ) cout << "existing\n"; else كم ساعادتك عنادما تح اااااق إنجاااااازات يعت اااد الناااا إناااك حتما تعجز عنها cout << "not existing\n"; return 0; } ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 1-D arrays with functions (search-key-count) write a function that gets an array, its number of elements and a key. the function should return how many times key presents in the array. (2 KD) enter 7 numbers: 2.5 1.7 7.2 15.5 17.8 7.2 1.1 enter the search key: 7.2 # include <iostream> existing 2 times using namespace std; enter 7 numbers: 2.5 1.7 7.2 15.5 17.8 7.2 1.1 enter the search key: 3.6 not existing int main ( ) { double x [7], key; int c; cout << "enter 7 numbers: "; for (int i = 0; i < 7; i = i+1) cin >> x [i]; cout << "enter the search key: "; cin >> key; c = search (x, 7, key); if (c > 0 ) cout << "existing " << c << " times" << end l; else cout << "not existing" << end l; return 0; } ال تنافس إال على ال مـة ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 1-D arrays with functions (minimum) write a function that gets an array and its number of elements. the function should return the minimum element in the array. (2 KD) # include <iostream> using namespace std; enter 7 numbers: 2.5 1.9 7.2 15.5 1.8 7.2 the minimum is: 1.8 11.1 int main ( ) { double x [7], min; cout << "enter 7 numbers: "; for (int i = 1; i <= 7; i ++) cin >> x [i-1]; min = minimum (x,7); cout << "minimum is: " << min << end l; ال يصمد مع العزيمة شيء return 0; } ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 1-D arrays with functions (minimum Index) write a function that gets an array and its number of elements. the function should return the index of minimum element in the array. (2 KD) enter 7 numbers: 2.5 1.9 7.2 15.5 1.8 7.2 the index is: 4 # include <iostream> using namespace std; the minimum is: 1.8 11.1 int main ( ) { double x [7]; int min; cout << "enter 7 numbers: "; for (int i = 1; i <= 7; i ++) cin >> x [i-1]; min = minimum (x, 7); cout << "the index is: " << min << end l; cout << "the minimum is: " << x [min] << end l; return 0; } لعله من عجائب الحيااة إنااك إذا رفضاات كاال مااا فإنااك،هاو دون ال مااة غالبا ستحصل عليه ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 1-D arrays with functions (equal-arrays) write a function that gets two arrays of same size, the function should return true if they are exactly equal, false otherwise. # include <iostream> using namespace std; bool equal_arrays (int [], int [], int); int main ( ) { int x [100], y[100], n, i; bool equal; cout << "enter number of integers: "; cin >> n; cout << "enter elements of first array: "; for (i = 0 ; i < n; i ++) cin >> x [i]; cout << "enter elements of second array: "; for (i = 0; i < n; i++) cin >> y [i]; equal = equal_arrays (x, y, n); if (equal == true) cout << "equal\n"; else cout << "not equal\n"; return 0; } مااا يمكناا تخيلااه يمكناا ومااااا يمكنااااا،تح ي ااااه تح ي ااااااه لاااااان نعاااااادم طري ا للوصول إليه ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 1-D arrays (output) what is the output of the following codes T h i s i s 0 2 4 6 a. a n e 8 10 a s 12 y 14 e x 16 a m 18 \0 20 int main( ) { char str[]="This is an easy exam"; int i = 14; output while(str[i] != 'x') { cout << str[i]; i -= 3; cout << str[i]; i += 2; cout << str[i++]; i+=3; 6 3 2 } b. 7 int main( ) { int i, hold, n = 7; int x[7] = {6, 3, 2, 7, 1, 8, 4}; 1 i 0 1 2 for (i = 0 ; i < n/2 ; i++) { hold = x[i]; x[i] = x[n-1-i]; output x[n-1-i] = hold; } cout << "new x is: "; for (i = 0 ; i < n ; i++) cout << x[i] << " "; cout << endl; return 0; 8 hold مهما بالمت في ت ييم قدراتك فمالبا لن تخطأ } ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م 4 March 2010 1-D arrays with functions (recursive-search-key) write a recursive function that gets an array, its number of elements and a key. the function should return true if key exists in the array, false otherwise. (2 KD) enter 7 numbers: 2.5 1.7 7.2 15.5 17.8 7.2 1.1 enter the search key: 17.8 existing # include <iostream> using namespace std; enter 7 numbers: 2.5 1.7 7.2 15.5 17.8 7.2 1.1 enter the search key: 3.6 not existing int main ( ) { double x [7], key; cout << "enter 7 numbers: "; for (int i = 6; i >= 0; i --) cin >> x [i]; cout << "enter the search key: "; cin >> key; if (search (x, 7, key) == false) cout << "not existing\n"; ي ا عمر المرء بما خلف وراءه وليس ب در ما عاش else cout << "existing\n"; return 0; } ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 1-D arrays with functions (recursive-search-key-count) write a recursive function that gets an array, its number of elements and a key. the function should return how many times key presents in the array. (2 KD) # include <iostream> using namespace std; enter 7 numbers: 2.5 1.7 17.8 15.5 17.8 7.2 1.1 enter the search key: 17.8 existing 2 times2.5 1.7 7.2 15.5 17.8 7.2 1.1 enter 7 numbers: enter the search key: 3.6 not existing int main ( ) { double x [7], key; int c; cout << "enter 7 numbers: "; for (int i = 0; i < 7; i = i+1) cin >> x [i]; cout << "enter the search key: "; cin >> key; c = search (x, 7, key); if (c > 0) cout << "existing " << c << " times" << end l; else cout << "not existing" << end l; return 0; } الذين يحصلون على الجوائز يدفعون ثمنا م دما لها ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 1-D arrays with functions (recursive-sum-evens) write a recursive function that gets an integer array and its number of elements. the function should return the sum of even elements in the array. (2 KD) enter 10 integers: 2 1 5 7 8 10 3 4 9 6 sum evens is: 30 # include <iostream> using namespace std; int main ( ) { int x [10], i, sum; cout << "enter 10 integers: "; for (i = 0; i <= 9; i++) cin >> x [i]; sum = sum_evens (x, 10); cout << "sum evens is: " << sum << end l; return 0; } الصق بالنااجحين تاااااانجح فااااااالمرء على دين خليله ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 1-D arrays (output) output Result is الفاشلون يعت دون أن النجاح مجرد عملية حظ ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م March 2010 output النجاح عادة وكذلك يكون الفشل ) أو بالبريد االلكترونيSMS هدية قيمة عنـد التنبيه على كـل خطـأ ( برسالة Statics, Strength, Dynamics, Mechanical Design I, II, Vibrations, Survey, Management, Structural Analysis I, II, Heat C++, Java, MATLAB, Data Structures, Algorithms, Discrete, Digital Logic, Concepts, Databases, Software English 123, 162, 221, TOEFL, Numerical Methods, Economy, Supply Chain www.eng-hs.net شرح ومسائل محلولة مجانا بالموقع [email protected] 9 4444 260 حمادة شعبان.م