Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication10
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Podaj ilosc wierszy");
- int i = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Podaj ilosc kolumn");
- int j = Convert.ToInt32(Console.ReadLine());
- double[,] tab = new double[i, j];
- wczytaj(ref tab);
- wyswietl(tab);
- Console.WriteLine("Ktory wiersz chcesz zamienic");
- int o = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("... a z ktorym?");
- int p = Convert.ToInt32(Console.ReadLine());
- double[,]Y = new double[p,j];
- zamiana(tab, Y, o,p);
- wyswietl(tab);
- Console.ReadKey();
- }
- static void zamiana(double[,] tab, double[,] Y, int o, int p)
- {
- for (int i = 0; i < tab.GetLength(0); i++)
- {
- for (int j = 0; j < tab.GetLength(1); j++)
- {
- Y[p, j] = tab[o, j];
- }
- }
- }
- static void wczytaj(ref double[,] tab)
- {
- Random obiekt = new Random();
- for (int i = 0; i < tab.GetLength(0); i++)
- {
- for (int j = 0; j < tab.GetLength(1); j++)
- {
- tab[i, j] = obiekt.Next(0, 5);
- }
- }
- }
- static void wyswietl(double[,] tab)
- {
- for (int i = 0; i < tab.GetLength(0); i++)
- {
- for (int j = 0; j < tab.GetLength(1); j++)
- Console.Write(" {0} ", tab[i, j]);
- Console.Write("\n");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement