عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 29-10-2014, 04:12 PM   #3

سملّق :)

أصلاً أنا أحب الحاسب عادي

الصورة الرمزية سملّق :)

 
تاريخ التسجيل: Jul 2011
كلية: كلية الحاسبات وتقنية المعلومات
التخصص: ما احبه
نوع الدراسة: إنتظام
المستوى: متخرج
البلد: اوربا
الجنس: ذكر
المشاركات: 1,385
افتراضي رد: برمجة 203 و 202 استفسارات وحلول

هذا الحل ومعليش ع التأخير

والشرح بداخل الكود ، كل سطر مشروح

كود PHP:
        Scanner in = new Scanner(System.in);
        
        
// declaraion num1, num2, and, the opration .
        
int num1,num2;
        
char opration 0;
       
        
// inserting the inputs by the user 
        
System.out.println(">  Insert the First Number :");
        
num1 in.nextInt();
        
System.out.println(">  Insert the Secound Number :");
        
num2 in.nextInt();
        
        
// inserting the Opration as a Char 
        
System.out.println(">  Insert the Opration :");
        
opration in.next().charAt(0);
        
        
        
// Switch statment , it means " check the Opration that user insert "
        
switch (opration){
        
            
// if opration + do that and Break out of the Switch statment, and so on ...
            
case '+':{
                
System.out.println("Result : "+ (num1+num2) ); 
                break;
                     }
            
            case 
'-':{
                
System.out.println("Result : "+ (num1-num2) ); 
                break;
                     }
            
            case 
'*':{ 
                
System.out.println("Result : "+ (num1*num2) );
                break;
                     }
            
            case 
'/':{ 
                
System.out.println("Result : "+ (num1/num2) ); 
                break;
                     }
            
            
            
/* this line "default" means which if the Opration Not from the above !
                It's like the 'else' in the If statment !
            */
            
default : {
                
System.out.println("Error : There is a problem in the Opration !");
                break;
                      }
        
        } 
بالتوفيق

 

توقيع سملّق :)  

 

سبحان الله وبحمده ، سبحان الله العظيم نقرتين لعرض الصورة في صفحة مستقلةنقرتين لعرض الصورة في صفحة مستقلة

 

سملّق :) غير متواجد حالياً   رد مع اقتباس