Facebook
From Innocent Hamerkop, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 298
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp18
  8. {
  9.     class Kalkulator
  10.     {
  11.         int liczba1;
  12.         int liczba2;
  13.         char znak;
  14.         int wynik;
  15.         public Kalkulator()
  16.         {
  17.  
  18.             //int a = PodajWynikDodawania(4, 5);
  19.             //Console.WriteLine(a);
  20.             PobierzWartosciZkonsoli();
  21.             if(znak == '+')
  22.             {
  23.                 wynik = PodajWynikDodawania(liczba1, liczba2);
  24.                 Console.WriteLine(wynik);
  25.  
  26.             }
  27.             else if (znak == '*')
  28.             {
  29.                 wynik = PodajWynikMnozenia(liczba1, liczba2);
  30.                 Console.WriteLine(wynik);
  31.  
  32.  
  33.             }
  34.         }
  35.  
  36.         void PobierzWartosciZkonsoli()
  37.         {
  38.             Console.WriteLine("Podaj liczbę");
  39.             liczba1 = Convert.ToInt32(Console.ReadLine());
  40.  
  41.             Console.WriteLine("Podaj drugą liczbę");
  42.             liczba2 = Convert.ToInt32(Console.ReadLine());
  43.  
  44.             Console.WriteLine("Podaj działanie");
  45.             string wpisanyNapis = Console.ReadLine();
  46.             znak = wpisanyNapis[0];
  47.            
  48.         }
  49.  
  50.         int PodajWynikDodawania(int wartosc1, int wartosc2)
  51.         {
  52.             int suma = wartosc1 + wartosc2;
  53.             return suma;
  54.         }
  55.        
  56.     }
  57. }
  58.  

Replies to Untitled rss

Title Name Language When
Re: Untitled Gentle Marmoset text 5 Years ago.