Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Ezaz
//Rextester.Program.Main is the entry point for your code. Don't change it. //Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354) using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Collections; using System.Text; using System.Threading.Tasks; using System.IO; using System.Globalization; /* namespace proba { class Program { public struct kutya { public string fajta; public string nem; public byte eletkor; public string nev; } static void Main() { StreamWriter iras = new StreamWriter("kutyak.txt", false,Encoding.Default); iras.WriteLine("mopsz;kan;3;Pluto"); iras.WriteLine("mopsz;szuka;6;Jazmin"); iras.WriteLine("mopsz;kan;1;Lassie"); iras.WriteLine("mopsz;kan;7;Bonyhart"); iras.WriteLine("tacsko;szuka;1;Lille"); iras.WriteLine("tacsko;szuka;1;Bodi"); iras.WriteLine("tacsko;kan;3;Bodri"); iras.WriteLine("tacsko;kan;7;Birk"); iras.WriteLine("agar;szuka;2;Biboca"); iras.WriteLine("nemetjuhasz;kan;8;Volt"); iras.Close(); List<kutya> kutyak = new List<kutya>(); FileStream fs = new FileStream("kutyak.txt", FileMode.Open); StreamReader sr = new StreamReader(fs, Encoding.UTF8); string sor = ""; while(!sr.EndOfStream) { sor = sr.ReadLine(); string[] darabok = sor.Split(';'); kutya k = new kutya(); k.fajta = darabok[0]; k.nem = darabok[1]; k.eletkor = Convert.ToByte(darabok[2]); k.nev = darabok[3]; kutyak.Add(k); } sr.Close(); fs.Close(); foreach(kutya elem in kutyak) { Console.WriteLine(elem.nev + " " + elem.fajta + " " + elem.eletkor + " " + elem.nem); } Random rd = new Random(); int size = 50; int villa[size]; for(int i = 0; i < 50; i++) { Console.WriteLine(villa[i]); } ArrayList pelda = new ArrayList(50); pelda.Add(9); pelda.Add("Ez a szoveg"); pelda.Add('s'); pelda.Add(true); Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine(pelda[1] is string); Console.WriteLine(pelda[0] is string); Console.WriteLine(pelda[1].GetType()); Console.WriteLine(pelda[0].GetType()); for(int i = 0; i < pelda.Count; i++) { Console.WriteLine(pelda[i]); } int a = Convert.ToInt32(pelda[0]); string b = (string) pelda[1]; Console.WriteLine(a + " " + b); List<int> pelda2 = new List<int>(50); pelda2.Add(2); pelda2.Add(3); pelda2.Add(5); pelda2.Add(8); pelda2.Add(10); pelda2.Add(12); pelda2.Add(14); pelda2.Add(15); Console.WriteLine(""); for(int i = 0; i < pelda2.Count; i++) { Console.Write(pelda2[i] + " "); } Console.WriteLine(""); Console.WriteLine(pelda2.Contains(3)); Console.WriteLine(pelda2.Contains(1)); pelda2.Insert(3, 6); pelda2.Remove(15); pelda2.RemoveAt(0); pelda2.RemoveAt(6); for(int i = 0; i < pelda2.Count; i++) { Console.Write(pelda2[i] + " "); } Console.WriteLine(""); Console.WriteLine(""); int[] szamok = new int[10]; szamok[0] = 5; szamok[2] = 4; szamok[1] = 7; szamok[3] = 8; szamok[4] = 9; for(int i = 0; i < 10; i++) { Console.Write(szamok[i] + " "); } Console.WriteLine(""); Console.WriteLine(""); int[,] szam = new int[2,3]; for(int i = 0; i < 2; i++) { for(int j = 0; j < 3; j++ ) { szam[i,j] = 2*i + j; } } for(int i = 0; i < 2; i++) { for(int j = 0; j < 3; j++ ) { Console.Write(szam[i,j] + "\t"); } } Console.WriteLine(""); Console.WriteLine(""); int[] v = new int[100]; Random r = new Random(); for(int i = 0; i < 100; i++) { v[i] = r.Next(0, 1000); } for(int i = 0; i < 100; i++) { Console.Write(v[i] + "\t"); */ namespace Rextester { public class Program { public static void Main(string[] args) { /* StreamWriter iras = new StreamWriter("kutyak.txt", false,Encoding.Default); iras.WriteLine("mopsz;kan;3;Pluto"); iras.WriteLine("mopsz;szuka;6;Jazmin"); iras.WriteLine("mopsz;kan;1;Lassie"); iras.WriteLine("mopsz;kan;7;Bonyhart"); iras.WriteLine("tacsko;szuka;1;Lille"); iras.WriteLine("tacsko;szuka;1;Bodi"); iras.WriteLine("tacsko;kan;3;Bodri"); iras.WriteLine("tacsko;kan;7;Birk"); iras.WriteLine("agar;szuka;2;Biboca"); iras.WriteLine("nemetjuhasz;kan;8;Volt"); iras.Close(); List<kutya> kutyak = new List<kutya>(); FileStream fs = new FileStream("kutyak.txt", FileMode.Open); StreamReader sr = new StreamReader(fs, Encoding.UTF8); string sor = ""; while(!sr.EndOfStream) { sor = sr.ReadLine(); string[] darabok = sor.Split(';'); kutya k = new kutya(); k.fajta = darabok[0]; k.nem = darabok[1]; k.eletkor = Convert.ToByte(darabok[2]); k.nev = darabok[3]; kutyak.Add(k); } sr.Close(); fs.Close(); foreach(kutya elem in kutyak) { Console.WriteLine(elem.nev + " " + elem.fajta + " " + elem.eletkor + " " + elem.nem); } */ /* Random rd = new Random(); int size = 50; int villa[size]; for(int i = 0; i < 50; i++) { Console.WriteLine(villa[i]); } */ ArrayList pelda = new ArrayList(50); pelda.Add(9); pelda.Add("Ez a szoveg"); pelda.Add('s'); pelda.Add(true); Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine(pelda[1] is string); Console.WriteLine(pelda[0] is string); Console.WriteLine(pelda[1].GetType()); Console.WriteLine(pelda[0].GetType()); for(int i = 0; i < pelda.Count; i++) { Console.WriteLine(pelda[i]); } int a = Convert.ToInt32(pelda[0]); string b = (string) pelda[1]; Console.WriteLine(a + " " + b); List<int> pelda2 = new List<int>(50); pelda2.Add(2); pelda2.Add(3); pelda2.Add(5); pelda2.Add(8); pelda2.Add(10); pelda2.Add(12); pelda2.Add(14); pelda2.Add(15); Console.WriteLine(""); for(int i = 0; i < pelda2.Count; i++) { Console.Write(pelda2[i] + " "); } Console.WriteLine(""); Console.WriteLine(pelda2.Contains(3)); Console.WriteLine(pelda2.Contains(1)); pelda2.Insert(3, 6); pelda2.Remove(15); pelda2.RemoveAt(0); pelda2.RemoveAt(6); for(int i = 0; i < pelda2.Count; i++) { Console.Write(pelda2[i] + " "); } Console.WriteLine(""); Console.WriteLine(""); int[] szamok = new int[10]; szamok[0] = 5; szamok[2] = 4; szamok[1] = 7; szamok[3] = 8; szamok[4] = 9; for(int i = 0; i < 10; i++) { Console.Write(szamok[i] + " "); } Console.WriteLine(""); Console.WriteLine(""); int[,] szam = new int[2,3]; for(int i = 0; i < 2; i++) { for(int j = 0; j < 3; j++ ) { szam[i,j] = 2*i + j; } } for(int i = 0; i < 2; i++) { for(int j = 0; j < 3; j++ ) { Console.Write(szam[i,j] + "\t"); } } Console.WriteLine(""); Console.WriteLine(""); int[] v = new int[100]; Random r = new Random(); for(int i = 0; i < 100; i++) { v[i] = r.Next(0, 1000); } for(int i = 0; i < 100; i++) { Console.Write(v[i] + "\t"); } Console.WriteLine("\n" + "\n" + "\n" + "\n"); int a56 = 8; kiir(a56); string abc = Console.ReadLine(); a56 = System.Int32.Parse(abc); kiir(a56); } static void kiir(int szam) { Console.WriteLine(szam); } } }
run
|
edit
|
history
|
help
0
Uri Parts
наименьшее общее кратное двух чисел a и b
Rijndael
up casting down casting
DSXSAXS
String Factorial Sorter
JOE'S C# CODE
Math 5.85a
length
sdfrgthyuyt dsxcsd