Jump to content
منتدى البحرين اليوم

Recommended Posts

Posted

مررحبا ..

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

عيزني ,,

و ذبحني و ماعرفت له

المقرر كله لوعة جبد

و ايييب القهر

 

Q1# # Use do while

 

Write a program that will read two integers and give the user a menu to choose wither to(add/subtract/divide/multiply or quit) it will keep giving the user the menu until the quits.

Sample input/output

Enter two numbers:9 5

 

Choose from the menu below:

 

1. addition

2. 2. subtraction

3. multiplication

4. division

5. quit

your option is:1

the result is: 14

 

choose from the menu below:

 

6. addition

7. 2. subtraction

8. multiplication

9. division

10. quit

your option is:2

the result is: 4

 

11. addition

12. 2. subtraction

13. multiplication

14. division

15. quit

your option is:5

 

 

 

================================

 

 

Q 2 ## (use for loop)

 

Write a program that reads in the size of the side of a square and then prints a hollow square of that size out asterisks and blanks. Your program should work for squares of all side sizes between 1 and 20 .for example , if your program read a size of 5, it should print

 

*****

* *

* *

* *

*****

 

 

 

بلييييييييييييييز آنطرر الحل قبل الاربعا اذا ممكن ..

و شكرا مقدما

 

باااااااااااايز

 

 

Posted

اوراق باكية

هاي رقم 1.. الثاني ما عرفت شيبون بس بسأل لج معلمتنا و احاول احله..

 

تمرين 1

# include <iostream.h>

int main()

 

{

 

int z,x=0,c,sum;

 

cout<<"please Input two integers number";

cin>>x>>z;

while (x>0)

 

{

cout<<"Choose from the menu below:\n1. addition\n 2. subtraction\n3. multiplication\n4. division\n5. quit\n";

 

cout<<"your option is:";

cin>>c;

 

if (c==1)

{

sum=x+z;

cout<<"the result is:"<<sum;

 

}

 

else if (c==2)

 

{

sum=x-z;

cout<<"the result is:"<<sum;

 

}

 

else if (c==3)

 

{

sum=x*z;

cout<<"the result is:"<<sum;

 

}

else if (c==4)

 

{

sum=x/z;

cout<<"the result is:"<<sum;

 

}else if (c==5)

 

{

sum=x+z;

cout<<"the result is:"<<sum;

return 0;

}

 

}

 

return 0;

 

}

 

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
الرد على هذا الموضوع...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...