- 1
Зачем простенькие проги, написанные на MASM коннектятся к ip адресу Microsoft 20.99.133.109:443?
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 15
−3
Зачем простенькие проги, написанные на MASM коннектятся к ip адресу Microsoft 20.99.133.109:443?
0
Как написать компилятор на PHP?
0
using System;
namespace MainNamespace
{
class SelectionSort
{
private static int FindSmallest(int[] arr)
{
int smallest = arr[0];
int smallestIndex = 0;
for (int i = 1; i < arr.Length; i++)
{
if (arr[i] < smallest)
{
smallest = arr[i];
smallestIndex = i;
}
}
return smallestIndex;
}
public static int[] ArraySort(int[] arr)
{
int[] newArr = new int[arr.Length];
for (int i = 0; i < arr.Length; i++)
{
int smallestIndex = FindSmallest(arr);
int arrayBeginningIndex = i;
newArr[arrayBeginningIndex] = arr[smallestIndex];
arr[smallestIndex] = Int32.MaxValue;
}
return newArr;
}
}
class MainClass
{
const int sizeOfArr = 7;
static int FindMaxProduct(int[] arr)
{
int maxProduct = 1;
int firstIndex = 0;
int secondIndex = 1;
int lastIndex = sizeOfArr - 1;
int beforeLastIndex = sizeOfArr - 1 - 1;
int beforeBeforeLastIndex = sizeOfArr - 1 - 2;
if (arr[firstIndex] * arr[secondIndex] * arr[lastIndex] > arr[beforeLastIndex] * arr[beforeBeforeLastIndex] * arr[lastIndex])
{
maxProduct = arr[firstIndex] * arr[secondIndex] * arr[lastIndex];
}
else
for (int i = 0; i < 3; i++)
maxProduct *= arr[lastIndex - i];
return maxProduct;
}
static void Main()
{
int[] arr = new int[sizeOfArr] {-31, 54, -39, -34, 0, 56, 92};
arr = SelectionSort.ArraySort(arr);
Console.WriteLine( FindMaxProduct(arr) );
Console.ReadKey();
}
}
}
Есть массив с целыми числами. Найти в этом массиве самое большое произведение 3 чисел и вывести в консоль.
0
if (1 != 1)
{
1 = 1;
}
else if (2 != two)
{
2 = 1;
}
else if (1 == one)
{
3 = two;
}
else if (two != three)
{
3 != 2;
}
else
{
DynamicSenseMessage("Are you coding with JavaScript, son?");
}
+1
using System;
namespace MainNamespace
{
class MainClass
{
static string str, sep;
static void Sep()
{
int k = 0;
while (k < str.Length * 2 - 5)
{
if (sep.Length * (k + 1) > str.Length * 2 - 5)
break;
Console.Write(sep);
k++;
}
for (int l = 0; l < ((str.Length * 2 - 5) - (k * sep.Length)) ; l++)
Console.Write(sep[l]);
}
static void Main(string[] args)
{
Console.Write("str: ");
str = Console.ReadLine();
Console.Write("sep: ");
sep = Console.ReadLine();
for (int i = 0; i < str.Length-1; i++)
Console.Write(str[i] + " ");
Console.Write(str[str.Length-1] + "\n\n");
for (int j = 0; j < str.Length - 2; j++)
{
Console.Write(str[j + 1] + " ");
Sep();
Console.WriteLine(" " + str[str.Length - j - 2]);
Console.Write(" ");
if(j < str.Length - 3)
{
Sep();
Console.WriteLine(" ");
continue;
}
Console.WriteLine();
}
for (int m = str.Length-1; m >= 1; m--)
Console.Write(str[m] + " ");
Console.WriteLine(str[0]);
Console.ReadKey();
}
}
}
Переписал код http://govnokod.ru/27324 на Шарп с небольшими улучшениями.
0
А вы знали, что вязанная бабушкина жилетка с оленями даёт +25 к навыку программирования?
0
https://puu.sh/Huwm1/b04eed45b1.png
Слишком хорошо, чтобы быть правдой.
0
Как перестать быть хеллоуворлдщиком и стать нормальным быдлокодером?
0
using System;
namespace NoName
{
class TwoVariables
{
static void Main(string[] args)
{
Int32 FirstVariable = Convert.ToInt32(Console.ReadLine());
Int32 SecondVariable = Convert.ToInt32(Console.ReadLine());
FirstVariable = FirstVariable + SecondVariable;
SecondVariable = FirstVariable - SecondVariable;
FirstVariable = FirstVariable - SecondVariable;
Console.WriteLine("First Variable is: " + FirstVariable);
Console.WriteLine("Second Variable is: " + SecondVariable);
Console.ReadKey();
}
}
}
// Продам гараж
0
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <conio.h>
const int x_size(20), y_size(10); int x_pos(x_size/2+1); int y_pos(y_size/2+1);
enum border_types{lineNL, single, singleNL};
enum directions{UpLeft=1, UpRight, DownLeft, DownRight}dir;
void draw_border(enum border_types borders) {
do{
if(borders == single || borders == singleNL) break;
for(int i=0; i<x_size+1; i++)
putchar('#');
}while(false);
putchar('#');
if(borders == singleNL || borders == lineNL) std::cout << '\n';}
void display_update() {
system("cls");
draw_border(lineNL);
for(int i=1; i<=y_size; i++)
{
draw_border(single);
for(int j=1; j<=x_size; j++)
{
if(j == x_pos && i == y_pos)
{
putchar('x');
continue;
}
putchar(32);
}
draw_border(singleNL);;
}
draw_border(lineNL);
std::cout << "X: " << x_pos << "\tY: " << y_pos;}
void logic() {
switch(x_pos)
{
case 1:
if(dir == UpLeft) dir = UpRight;
if(dir == DownLeft) dir = DownRight;
break;
case x_size:
if(dir == UpRight) dir = UpLeft;
if(dir == DownRight) dir = DownLeft;
}
switch(y_pos)
{
case 1:
if(dir == UpLeft) dir = DownLeft;
if(dir == UpRight) dir = DownRight;
break;
case y_size:
if(dir == DownLeft) dir = UpLeft;
if(dir == DownRight) dir = UpRight;
}}
void move() {
switch(dir)
{
case UpLeft:
x_pos--;
y_pos--;
break;
case UpRight:
x_pos++;
y_pos--;
break;
case DownLeft:
x_pos--;
y_pos++;
break;
case DownRight:
x_pos++;
y_pos++;
}}
int main() {
srand(time(0));
rand();
switch(rand()%4+1)
{
case UpLeft:
dir = UpLeft;
break;
case UpRight:
dir = UpRight;
break;
case DownLeft:
dir = DownLeft;
break;
case DownRight:
dir = DownRight;
}
while(!kbhit())
{
display_update();
logic();
move();
}
return 0;}
Сорян, пришлось уплотнить фигурные скобки, чтобы код уместился в 100 строк.