بســم الله الـرحمــن الرحيــم
السلام عليكــم ورحمـة الله وبركاتــه
شباب وابطال الـ c++ ... الدكتور عاطني اسايمنت اسويه وانا كلش ما اعرف شي في c++ فــ أملي وثقتي فيكم كبيره جداً بأن تقوموا بالتكرم في حل هذا الاسايمنت ... اتمنى ما تخيبون املي فيكم شباب
هذا الاسايمنت..
a) Modularize the following code:
#include <iostream>
using namespace std;
int main()
{
int x; // base
int y; // exponent
cout << "Enter the first integer: "; // prompt for x
cin >> x; // input base
cout << "Enter the second integer: "; // prompt for y
cin >> y; // input exponent
//find the x to the power of y
int i; // counts from 1 to y
int power; // used to calculate x raised to power y
i = 1; // initialize i to begin counting from 1
power = 1; // initialize power
// count from 1 to y and multiply power by x each time
while ( i <= y )
{
power *= x;
i++;
} // end while
cout <<"x to the power of y = " <<power << endl; // display result
// find the product of x and y
int product;
product = x * y;
cout <<"x * y = " << product<< endl; // display result
// find the average
int average;
average = product / 2;
cout <<"The average is: " << average<<endl; // display result
return 0; // indicate successful termination
} // end main
B) Create the Hierarchy Chart for (a)
بليز شباب ساعدوني ....
القاكم في ما بعد ..