انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

lesson 5

الكلية كلية العلوم للبنات     القسم قسم الحاسبات     المرحلة 1
أستاذ المادة ماجد جبار جواد الفنهراوي       10/11/2018 06:24:24
1 Examples of order evaluation:


Example

1. Write the following equation as a C++ expression:



Note: the parentheses here are required because division has a higher precedence than addition.
Example

Write C++ program to perform the above equation:

void main( )
{
int Z, P, R, Q, W, X, Y;
cout << "enter P:";
cin >> P;
cout << "enter R:";
cin >> R;
cout << "enter Q:";
cin >> Q; cout << "enter W:";
cin >> W; cout << "enter X:";
cin >> X; cout << "enter Y:";
cin >> Y; Z= P * R % Q + W / X - Y;
cout << "the result="<< Z;
}

2 The “math.h” Library:

The “math.h” library contains the common mathematical function used in the scientific equations.

Example:

Write the following equation as a C++ expression and state the order of evaluation of the binary operators:



Solution:

f = sqrt ((sin(x) – pow(x,5)) / (log(x) + x/4))

3. Manipulator Functions:

They are special stream functions that change certain characteristics of the input and output.

(a) Endl: Generate a carriage return or line feed character.

cout << “a” << endl;

(b) Setbase: It is used to convert the base of one numeric value into another base


Dec(base 10), hex(base 16), oct(base 8)


المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .