![]() |
![]() |
![]()
Post
#1
|
|
![]() Grupa: Zarejestrowani Postów: 654 Pomógł: 17 Dołączył: 19.03.2006 Skąd: z kosmosu ;) Ostrzeżenie: (0%) ![]() ![]() |
Witam, uczę się C# z kursu centrumxp.pl i mam problem z tym kodem (sam napisałem bez pomocy... ale za to jest gdzieś błąd):
Kod using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace TestProgram { class Program { static void Main() { // Variables int[] Numbers = new int[2]; int Match; bool Fail = false; string Action; string ActionName; // What do you want to do? System.Console.WriteLine("Co chcesz zrobic:\n1. Dodac\n2. Odjac\n3. Pomnozyc\n4. Podzielic"); Action = System.Console.ReadLine(); // Get two numbers System.Console.WriteLine("Podaj liczbe nr.1:"); Numbers[0] = System.Convert.ToInt32(System.Console.ReadLine()); System.Console.WriteLine("Podaj liczbe nr.2:"); Numbers[1] = System.Convert.ToInt32(System.Console.ReadLine()); // Selecting action switch (Action) { case "1": ActionName = (string)"dodawania"; Match = Numbers[0] + Numbers[1]; break; case "2": ActionName = (string)"odejmowania"; Match = Numbers[0] - Numbers[1]; break; case "3": ActionName = (string)"mnozenia"; Match = Numbers[0] * Numbers[1]; break; case "4": ActionName = (string)"dzielenia"; Match = Numbers[0] / Numbers[1]; break; default: Fail = true; break; } if (Fail == false) System.Console.WriteLine("Wynik "+ActionName+": "+Match); else System.Console.WriteLine("Nie poprawna akcja wybrana."); } } } Cytat Error 1 Use of unassigned local variable 'ActionName' C:\Documents and Settings\*\Ustawienia lokalne\Dane aplikacji\Temporary Projects\TestProgram\Program.cs 53 51 TestProgram Error 2 Use of unassigned local variable 'Match' C:\Documents and Settings\*\Ustawienia lokalne\Dane aplikacji\Temporary Projects\TestProgram\Program.cs 53 67 TestProgram @edit W C# Mogę używać MySQL? @edit Jaka funkcja sprawdza czy argument jest liczbą/ciągiem itp (PHP: is_string(), is_int(), is_array() itp.)? Dziękuję, Babcia@Stefa Ten post edytował Babcia@Stefa 24.06.2008, 09:40:39 -------------------- Środowisko testowe (desktop) - Gedit, lighttpd, sftp, rsync, xfce4-terminal, chromium, firefox4 | System: Gentoo ~x86
O'Neill - serwer WWW @ lighttpd, links, nano, rsyncd, sftpd | System: Debian ![]() |
|
|
![]() ![]() |
![]() |
Aktualny czas: 21.08.2025 - 11:09 |