אשכול: עזרה ב C#
View Single Post
ישן 22-09-06, 09:34   # 1
Elad-A
הוסטסניון
 
מיני פרופיל
תאריך הצטרפות: May 2006
הודעות: 1,987

Elad-A לא מחובר  

עזרה ב C#

לאיפה אני אמור להיכנס בתוכנה כדי להכניס את הקודים ולהריץ אותם?
למשל יש את הקוד הבא: (המחשבון שרותם עשה)
קוד:
using System; 
using System.Collections.Generic; 
using System.Text; 

namespace Calculator 
{ 
    class Program 
    { 
        static void Main(string[] args) 
        { 
            int A; 
            int B; 
            char C; 

            Console.WriteLine("Welcome to C# calculator!"); 
            Console.WriteLine("Made by Rotem the programmer :P"); 

            Console.WriteLine(); 

            Console.Write("Please insert the first number: "); 
            A = int.Parse(Console.ReadLine()); 

            Console.Write("Please insert the second number: "); 
            B = int.Parse(Console.ReadLine()); 

            Console.Write("Please insert an action: "); 
            C = char.Parse(Console.ReadLine()); 

            if ((C == '/') || (B == 0)) 
            { 
                Console.WriteLine(); 
                Console.WriteLine("You can't division by zero!"); 
                Console.Read(); 
            } 

            else 
            { 
                switch (C) 
                { 
                    case '+': 
                        Console.WriteLine("The Result: {0} {1} {2} = {3}", A, C, B, A + B); 
                        Console.Read(); 
                        break; 

                    case '-': 
                        Console.WriteLine("The Result: {0} {1} {2} = {3}", A, C, B, A - B); 
                        Console.Read(); 
                        break; 

                    case '*': 
                        Console.WriteLine("The Result: {0} {1} {2} = {3}", A, C, B, A * B); 
                        Console.Read(); 
                        break; 

                    case '/': 
                        Console.WriteLine("The Result: {0} {1} {2} = {3}", A, C, B, A / B); 
                        Console.Read(); 
                        break; 

                    default: 
                        Console.WriteLine("There is a problem! :("); 
                        break; 
                } 
            } 
        } 
    } 
}
תודה למי שיעזור..
  Reply With Quote