- 1
- 2
- 3
- 4
- 5
- 6
void CsrSmException (void)
{
while(1){
Sleep(0);
};
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+154
void CsrSmException (void)
{
while(1){
Sleep(0);
};
}
Трушный индусский эксепшен :)
−102
class Node:
def __init__(self):
self.id = 0
self.d = None
self.left = None
self.right = None
def __del__(self):
del self
class Struct:
def __init__(self):
self.data = None
def add(self,data):
if self.data == None:
self.data = Node()
self.data.d = data
self.data.right = Struct()
else:
if self.data.d == data:
return 0
elif self.data.d != data:
return self.data.right.add(data)
def next(self):
if self.data != None:
print self.data.d
return self.data.right.next()
как правильно сделать чтобы при вызове next возвращалось значение не в print а в return и при рекурсия выполнялась
+144
switch($_POST['find'])
{
case 'a' :
echo '<p> Регулярный клиент.</p>';
break;
case 'b' :
echo '<p> Клиент, обратившийся после телефизионной рекламы.</p>';
break;
case 'c' :
echo '<p> Клиент, обратившийся в результате нахаождения информации в телефонном справочнике.</p>';
break;
case 'd' :
echo '<p> Клиент, обратившийся в результате чьей-то устной рекомендации.</p>';
break;
default :
echo '<p> Вы унылое говно</p>';
break;
}
+147
var CanvasText = {
/** The letters definition. It is a list of letters,
* with their width, and the coordinates of points compositing them.
* The syntax for the points is : [x, y], null value means "pen up"
*/
letters: {
'\n':{ width: -1, points: [] },
' ': { width: 10, points: [] },
'!': { width: 10, points: [[5,21],[5,7],null,[5,2],[4,1],[5,0],[6,1],[5,2]] },
'"': { width: 16, points: [[4,21],[4,14],null,[12,21],[12,14]] },
'#': { width: 21, points: [[11,25],[4,-7],null,[17,25],[10,-7],null,[4,12],[18,12],null,[3,6],[17,6]] },
'$': { width: 20, points: [[8,25],[8,-4],null,[12,25],[12,-4],null,[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]] },
'%': { width: 24, points: [[21,21],[3,0],null,[8,21],[10,19],[10,17],[9,15],[7,14],[5,14],[3,16],[3,18],[4,20],[6,21],[8,21],null,[17,7],[15,6],[14,4],[14,2],[16,0],[18,0],[20,1],[21,3],[21,5],[19,7],[17,7]] },
'&': { width: 26, points: [[23,12],[23,13],[22,14],[21,14],[20,13],[19,11],[17,6],[15,3],[13,1],[11,0],[7,0],[5,1],[4,2],[3,4],[3,6],[4,8],[5,9],[12,13],[13,14],[14,16],[14,18],[13,20],[11,21],[9,20],[8,18],[8,16],[9,13],[11,10],[16,3],[18,1],[20,0],[22,0],[23,1],[23,2]] },
'\'':{ width: 10, points: [[5,19],[4,20],[5,21],[6,20],[6,18],[5,16],[4,15]] },
'(': { width: 14, points: [[11,25],[9,23],[7,20],[5,16],[4,11],[4,7],[5,2],[7,-2],[9,-5],[11,-7]] },
')': { width: 14, points: [[3,25],[5,23],[7,20],[9,16],[10,11],[10,7],[9,2],[7,-2],[5,-5],[3,-7]] },
'*': { width: 16, points: [[8,21],[8,9],null,[3,18],[13,12],null,[13,18],[3,12]] },
'+': { width: 26, points: [[13,18],[13,0],null,[4,9],[22,9]] },
',': { width: 10, points: [[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]] },
'-': { width: 26, points: [[4,9],[22,9]] },
'.': { width: 10, points: [[5,2],[4,1],[5,0],[6,1],[5,2]] },
'/': { width: 22, points: [[20,25],[2,-7]] },
'0': { width: 20, points: [[9,21],[6,20],[4,17],[3,12],[3,9],[4,4],[6,1],[9,0],[11,0],[14,1],[16,4],[17,9],[17,12],[16,17],[14,20],[11,21],[9,21]] },
'1': { width: 20, points: [[6,17],[8,18],[11,21],[11,0]] },
'2': { width: 20, points: [[4,16],[4,17],[5,19],[6,20],[8,21],[12,21],[14,20],[15,19],[16,17],[16,15],[15,13],[13,10],[3,0],[17,0]] },
'3': { width: 20, points: [[5,21],[16,21],[10,13],[13,13],[15,12],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]] },
'4': { width: 20, points: [[13,21],[3,7],[18,7],null,[13,21],[13,0]] },
'5': { width: 20, points: [[15,21],[5,21],[4,12],[5,13],[8,14],[11,14],[14,13],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]] },
'6': { width: 20, points: [[16,18],[15,20],[12,21],[10,21],[7,20],[5,17],[4,12],[4,7],[5,3],[7,1],[10,0],[11,0],[14,1],[16,3],[17,6],[17,7],[16,10],[14,12],[11,13],[10,13],[7,12],[5,10],[4,7]] },
'7': { width: 20, points: [[17,21],[7,0],null,[3,21],[17,21]] },
'8': { width: 20, points: [[8,21],[5,20],[4,18],[4,16],[5,14],[7,13],[11,12],[14,11],[16,9],[17,7],[17,4],[16,2],[15,1],[12,0],[8,0],[5,1],[4,2],[3,4],[3,7],[4,9],[6,11],[9,12],[13,13],[15,14],[16,16],[16,18],[15,20],[12,21],[8,21]] },
'9': { width: 20, points: [[16,14],[15,11],[13,9],[10,8],[9,8],[6,9],[4,11],[3,14],[3,15],[4,18],[6,20],[9,21],[10,21],[13,20],[15,18],[16,14],[16,9],[15,4],[13,1],[10,0],[8,0],[5,1],[4,3]] },
':': { width: 10, points: [[5,14],[4,13],[5,12],[6,13],[5,14],null,[5,2],[4,1],[5,0],[6,1],[5,2]] },
';': { width: 10, points: [[5,14],[4,13],[5,12],[6,13],[5,14],null,[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]] },
'<': { width: 24, points: [[20,18],[4,9],[20,0]] },
'=': { width: 26, points: [[4,12],[22,12],null,[4,6],[22,6]] },
'>': { width: 24, points: [[4,18],[20,9],[4,0]] },
'?': { width: 18, points: [[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],null,[9,2],[8,1],[9,0],[10,1],[9,2]] },
'@': { width: 27, points: [[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],null,[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],null,[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],null,[19,16],[18,8],[18,6],[19,5]] },
'A': { width: 18, points: [[9,21],[1,0],null,[9,21],[17,0],null,[4,7],[14,7]] },
'B': { width: 21, points: [[4,21],[4,0],null,[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],null,[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]] },
'C': { width: 21, points: [[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]] },
'D': { width: 21, points: [[4,21],[4,0],null,[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]] },
'E': { width: 19, points: [[4,21],[4,0],null,[4,21],[17,21],null,[4,11],[12,11],null,[4,0],[17,0]] },
'F': { width: 18, points: [[4,21],[4,0],null,[4,21],[17,21],null,[4,11],[12,11]] },
'G': { width: 21, points: [[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],null,[13,8],[18,8]] },
'H': { width: 22, points: [[4,21],[4,0],null,[18,21],[18,0],null,[4,11],[18,11]] },
// ...
Нашли причину нежелания Flotr (одна из многочисленных JavaScript библиотек для генерации графиков) работать с кириллическими кодировками при отрисовке шрифтов.
http://code.google.com/p/flotr/source/browse/trunk/flotr/flotr/prototype/lib/canvastext.js
+146
#include <stdio.h>
#include <ctype.h>
unsigned int wordsCount(const char *str);
int main(int argc, char *argv[]) {
char *chr;
if(argc != 2)
return 255;
puts(argv[1]);
if(wordsCount(argv[1]) > 1) {
chr = argv[1];
while(*chr) {
if (*chr == '*')
*chr = '3';
if (*chr == '+')
*chr = '1';
if (*chr == '-')
*chr = '2';
chr++;
}
}
puts(argv[1]);
return 0;
}
unsigned int wordsCount(const char *str) {
unsigned int wordsCount = 0;
char isWord = 0;
while(*str) {
if(isalpha(*str)) {
isWord = 1;
} else if(isWord) {
wordsCount++;
isWord = 0;
}
str++;
}
if(isWord)
wordsCount++;
return wordsCount;
}
+1122.2
int SUM(int A, int B)
{
if (0 == A) return B;
if (0 == B) return A;
return (1 + (SUM(A, B - 1) + SUM(A - 1, B)) / 2);
}
рекурсивное вычисление суммы двух чисел.
+147
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
char end;
char *stroka[end];
int number[10] = {0,1,2,3,4,5,6,7,8,9};
int size = 0;
cout << "Input element of array: \n";
while(end != '*')
{
cin >> end;
*stroka[size] = end;
size++;
}
for(int i = 0; i < size-1; i++)
{
cout << stroka[i] << " ";
}
for(int i = 0; i < size-1; i++)
{
for(int j = 0; j < 10; j++)
{
if(*stroka[i] == number[j])
{
cout << *stroka[i] << " ";
}
}
}
system("PAUSE");
}
говнокод одногруппника. оно ещё и собирается 0_o.
+175.9
#define JUST_ANOTHER_MAGIC_NUMBER 4398476903476060
магия чисел
−130
i = 2
X = "blank"
index = ""
qty = "1"
For Each Z In sContents
If (Z.StartsWith("1") Or Z.StartsWith("2") Or Z.StartsWith("3") Or Z.StartsWith("4") Or Z.StartsWith("5") Or Z.StartsWith("6") Or Z.StartsWith("7") Or Z.StartsWith("8") Or Z.StartsWith("9")) Then
Line = Z.Split("|")
If Not Line(0).Contains(".") Then
index = Line(0)
qty = 1
End If
If Line(1).StartsWith("ID") Then
X = Line(3).Substring(15)
qty = Line(4)
Else
sheet.Cells(i, 1) = Line(2)
sheet.Cells(i, 2) = Line(3)
If Line(2) = X Then
sheet.Range("B" & i).Font.Bold = True
Else
If Line(0).StartsWith(index & ".") Then
sheet.Range("B" & i).IndentLevel() = 1
End If
End If
If Not Line(0).Contains(".") Then
sheet.Range("B" & i).Font.Bold = True
End If
If Line(5) = "N/A" Then
sheet.Cells(i, 3) = 0
Else
sheet.Cells(i, 3) = Line(5)
End If
sheet.Range("C" & i).NumberFormat = "[$$-2409]#,##0.00"
sheet.Cells(i, 4) = Line(7)
If qty > 1 Then
sheet.Cells(i, 5) = Line(4) * qty
Else
sheet.Cells(i, 5) = Line(4)
End If
sheet.Cells(i, 6) = "=E" & i & "*C" & i
sheet.Range("F" & i).NumberFormat = "[$$-2409]#,##0.00"
sheet.Range("D" & i, "E" & i).HorizontalAlignment = Excel.Constants.xlCenter
sheet.Range("A" & i, "F" & i).Font.Size = 10
sheet.Range("A" & i, "F" & i).Borders.LineStyle = Excel.Constants.xlSolid
i = i + 1
End If
End If
Next Z
чем не говнокод?
работает, хуле :)
+113.8
public object DeepCopy(object value)
{
try
{
return value;
}
catch (Exception ex)
{
throw ex;
}
}
такой код повсюду... Источник: http://ayende.com/Blog/archive/2009/04/13/there-are-so-many-things-wrong-with-this-codehellip.aspx