Új hozzászólás Aktív témák
-
metrion
aktív tag
válasz
trisztan94
#5036
üzenetére
Nem beadandóhoz kellett, hanem a vizsgámhoz

Ez volt a vizsgán és még ebből is hiányzik a sorcsere, számbekéréssel: [link]
-
metrion
aktív tag
válasz
Peter Kiss
#5033
üzenetére
Szia!
Értékelem a segítséged, de én még nem járok ezen a szinten.

-
metrion
aktív tag
válasz
trisztan94
#5030
üzenetére
Már megoldódott.
-
metrion
aktív tag
Sziasztok!
Ebbe tudnátok segíteni?
A lényeg, hogy kétdimenziós tömbbe nem lehet szám ismétlődés.
Egydimenziós tömbös verzió kész, de nem tudom, hogy kéne átírni 2D-re. :S
Random rnd = new Random();
int[] tomb = new int[5];
int i=0;
while(i<5)
{
tomb[i] = rnd.Next(10, 100);
int x = 0;
while ((x<=i)&&(tomb[x] != tomb[i]))
{
x++;
}
if (x == i)
{
i++;
}
}
for (i = 0; i < 5; i++)
{
Console.WriteLine(tomb[i]);
}
Console.ReadKey();
}
}
} -
metrion
aktív tag
válasz
trisztan94
#5026
üzenetére
És tényleg, nagyon köszi, jól működik!

-
metrion
aktív tag
válasz
trisztan94
#5022
üzenetére
Most ez: Error 1 No overload for method 'Max' takes 1 arguments

-
metrion
aktív tag
válasz
trisztan94
#5020
üzenetére
Na már csak 1 hiba: Console.WriteLine("A max: {0}", Max(max));
Error 1 The name 'max' does not exist in the current context
-
metrion
aktív tag
válasz
trisztan94
#5018
üzenetére
Kezdem feladni: static int Max(int[,] t, ref int max)
{
for (int x = 0; x < 5; x++)
{
for (int y = 0; y < 5; y++)
{
if (max > t[x, y])
{
max = t[x, y];
}
}
return max;
}
}
static void Main(string[] args)
{
int[,] t = new int[5, 5];
Random r = new Random();
Felt(t, r);
Kiir(t);
Console.WriteLine();
Console.WriteLine("A max: {0}", Max(ref max));
Kiir(t);
Console.ReadKey(); -
metrion
aktív tag
válasz
trisztan94
#5015
üzenetére
Köszi, de holnapra kéne és nem tudok rájönni.
Tuti valami apró hiba. -
metrion
aktív tag
-
metrion
aktív tag
válasz
trisztan94
#5011
üzenetére
De ez nem kétdimenziós. :S Megpróbáltam de nem jött össze.
-
metrion
aktív tag
Sziasztok!
Kétdimenziós tömb elemeit, hogy lehet csökkenőbe rendezni?
A növekvő megvan: static void Novekvo(int[,] t)
{
for (int x = 0; x < 5; x++)
{
for (int y = 0; y < 4; y++)
{
int min = y;
for (int i = y + 1; i < 5; i++)
if (t[x, i] < t[x, min])
min = i;
if (min != y)
{
int csere = t[x, min];
t[x, min] = t[x, y];
t[x, y] = csere;
}
}
}
}Ez kell csak fordítva?
-
metrion
aktív tag
válasz
Jester01
#4755
üzenetére
Köszi, de nem jó. :S
Amúgy ez a DrawStripe ez csak a függvény fantázianeve?
namespace magyar_zaszlo
{
class Program
{
static void Main(string[] args)
{
int kszelesseg = (Console.WindowWidth / 2);
int kmagassag = (Console.WindowHeight / 2);
Console.SetCursorPosition(kszelesseg, kmagassag);
DrawStripe(kszelesseg, kmagassag, ConsoleColor.Red);
DrawStripe(kszelesseg, kmagassag + 3, ConsoleColor.White);
DrawStripe(kszelesseg, kmagassag + 6, ConsoleColor.Green);
}
static void DrawStripe(int x, int y, ConsoleColor color)
{
Console.BackgroundColor = color;
for (int i = 0; i < 3; i += 1)
{
Console.SetCursorPosition(x, y + i);
for (int j = 0; j < 40; j += 1)
{
Console.Write(' ');
}
}
Console.ReadKey();
}
}
} -
metrion
aktív tag
válasz
Peter Kiss
#4753
üzenetére
int kszelesseg = (Console.WindowWidth / 2);
int kmagassag = (Console.WindowHeight / 2);
Console.SetCursorPosition(kszelesseg, kmagassag);
for (int i = 0; i < 12; i++)
{
for (int j = 0; j < 40; j++)
{
Console.BackgroundColor = ConsoleColor.Red;
Console.WriteLine(" ");
Console.BackgroundColor = ConsoleColor.White;
Console.WriteLine(" ");
Console.BackgroundColor = ConsoleColor.Green;
Console.WriteLine(" ");
}
}
Console.ReadKey(); -
metrion
aktív tag
Sziasztok!
Magyar zászlót, hogy tudok úgy csinálni, hogy 40 space hosszú legyen és 12 space magas?
Előre is köszi!
Új hozzászólás Aktív témák
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
- AKCIÓ! MSI MAG 325CQRXF QHD VA 240Hz 1ms monitor garanciával hibátlan működéssel
- TELJES KÖRŰ IT BESZERZÉS
- ÁRGARANCIA! Épített KomPhone Ryzen 5 5600X 16/32/64GB RAM RTX 5050 8GB GAMER PC termékbeszámítással
- GYÖNYÖRŰ iPhone 13 128GB Midnight -1 ÉV GARANCIA - Kártyafüggetlen, MS3576, 100% Akkumulátor
- Csere-Beszámítás! Lemezes Playstation 5 Slim konzol!
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest




