Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
دورة لغة ++C الدرس الخامس

دورة لغة ++C الدرس الخامس

Ratings: (0)|Views: 31 |Likes:
Published by tarigggg

More info:

Published by: tarigggg on Dec 17, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

12/17/2009

pdf

text

original

 
.........هتاكربو ل ةمحو يع سل دع نب دم ل ءاش  ايفشو ايحو اتودق نيرمو ءاي ض ىع سو صو لدم.......نيمج هو ه ىعو ادبو ه ت ا ز نام ذ ذخأ بر د ن اي  دب..... ديج صب ت  ىمت.....ا د  Question1: write a program that reads an integer and determine whether it is odd or even. (Hint: use the modulus operator .an even number is a multiple of two. anymultiple of two leaves a reminder of zero when divide by 2.( ةغ دأب ارب ةباب ق :و ؤسCد ذ اك  ددتو ي دع اخأب  ++ىع س جوز دع و   دعاس % د :هظح)جوز  ر دع يص2 (رف امئ قا........  اج رف  هظحم ذب 
#include <iostream.h >int main ( ){int number ;cout << " please enter the number : " ;cin >>number ;if (number % 2 == 0 )cout <<" \n The number is even " ;else (number % 2 == 1 )cout << " \n The number is odd " ;return 0 ;}
Questions2 :write a program that inputs one five digit number, separates the number in to individuals digits and prints the digits separated from one another by threespaces each .(hint :use combinations of integer division and the reminder operation(Example: enter a five digit number: 123451 2 3 4 5  ةغ دأب ارب ةباب ق:اث ؤسCامصفو اق ةسمخ ن  دع اخأب  ++.....ي ا اثمو ( /, % د هظح )ااس ثب هي ذ نع صف دع ك طو 
 
Example: enter a five digit number: 123451 2 3 4 5
#include <iostream.h >int main ( ){int number,num1,num2,num3,num4,num5 ;cout << " please enter a number with five digit: " ;cin >>number ;number =number%10000;num1= number/10000;number =number%1000;num2= number/1000;number =number%100;num3= number/100;number =number%10;num4= number/10;num5= number;cout<<num1<</t<<num2<</t<<num3<</t<<num4<</t<<num5<<end1;return 0 ;}
:سسسسسس سسسسس
 ذ ا  ي وا switch
 ةبا و else if يسب خ هيو ااو   د ا   ا و ل ءاش  ه رط ار ةباك ىع ريأت ة ن switch
 
switch (هتنراقم دل يغتل بتك ا) {case قل بتك اا ىلو ةنر:do the following code; caseةيناثل ةنراقل بتك ا:do the following code; ..default:do the following code;}
 ا   حswitchذ هب ا  او ها رم ريغم و ا ةيع   ىع مع اث ذخأ ادع رثك رف ضو ريغمswitch..... مع اثم  اثم1دسم خد ادع ث. وراب اعاطب و هي اق اخأب  ارب :1  ةعاطب ارone مع ر ي  ةسمخ ق ى ه ا ذو .switch.
1- #include <iostream> 2- int main()3- {4- int number;5- cout << "Enter Number:\t" ;6- cin >> number;7- switch (number) {8-case '1:' 9-cout<<"one;" 10- break; 11-case '2:' 12-cout<<"two;" 13- break; 14-case '3:' 15-cout<<"three;" 16- break; 17-case '4:' 18-cout<<"four;" 19- break; 20case '5:'21-cout<<"five;" 22- break; 23-default: 24-cout<<"error;" 25// { -end the switch26-return 0; 27// { -end the mainظحل,اقباس اهحرش ت قبا وط ن عبا رط م جما رش دس يغم ف نزخ ر د خ ن دبnumber ا اnumber  خswitch ةاح أب  رس,اقس ذ و case '1' يغ ة قباط numberعم1 ذ  د ام ط أcase ةشا ى عطone ق ادب breakر   ة ذ  اخswitch  ام ذswitchة عض  ك و.دئا رث

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->