Advertisement
MartisK

C# l2p

Mar 27th, 2018
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.30 KB | None | 0 0
  1. using System; // -> #include <iostream> c++; import Akjadlkjasd;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO; // - input output -> iomanip
  7.  
  8. namespace ConsoleApp2
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             // cout << "kintamas = " << kintamasis << "yra teigiamas ";
  15.             Console.Write("labas");
  16.             Console.Write("hello"); // -> cout << "hello";
  17.             Console.WriteLine("kita eilute"); // -> cout << "hello" << endl;
  18.             Console.Write("kita eilute2");
  19.  
  20.             int[] skaiciai = new int[5];
  21.  
  22.             using (StreamReader reader = new StreamReader(@"..\..\duomenys.txt"))
  23.             {
  24.                 string eilute = null;
  25.  
  26.                 while(null != (eilute = reader.ReadLine()))
  27.                 {
  28.                     string[] dalys = eilute.Split(',');
  29.  
  30.                     for (int i = 0; i < skaiciai.Length; i++) //
  31.                     {
  32.                         skaiciai[i] = int.Parse(dalys[i]);
  33.                     }
  34.                 }
  35.             }
  36.  
  37.             for (int i = 0; i < skaiciai.Length; i++)
  38.             {
  39.                 Console.WriteLine("skaiciai[{0}] = {1}", i, skaiciai[i]);
  40.             }
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement