- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
{
float y,a,b;
int x;
a=StrToFloat(Edit1->Text);
b=StrToFloat(Edit2->Text);
for (x=1;x<=10;x+=2);
{
y=x*x/(a+b);
Memo1->Lines->Add("x="+FloatToStr(x)+"\ty="+FloatToStr(y));
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+145
{
float y,a,b;
int x;
a=StrToFloat(Edit1->Text);
b=StrToFloat(Edit2->Text);
for (x=1;x<=10;x+=2);
{
y=x*x/(a+b);
Memo1->Lines->Add("x="+FloatToStr(x)+"\ty="+FloatToStr(y));
}
}
программа вычисления функции , при изменении Х от 1 до 10 .
+164
BYTE* ptr = PreventCommand(mode,3);
WORD chksum=this->calc_chksum((BYTE*)(ptr+2));
ptr[4] = (char)(chksum/256 & 0xff);
ptr[5] = (char)(chksum%256 & 0xff);
_interface_array[0]->write(ptr,6, NULL);
delete [] ptr;
Формирование пакета
На третью и четвертую строки смотреть особенно больно.
+177
if (!($user_info['room'] == 900002) || $user_info['room'] != 900002) {
header("Location: main.php");
die();
}
Разгребаю чужой код и нарыл.
Чтобы условие выглядело посолидней ... или я чего-нить не понимаю.
+144
<?php
$valueOne = (5 > 1) ? true : false;
?>
http://en.wikipedia.org/wiki/%3F:#PHP
+141
sprintf(name," %s", trim("рубль",0));
Функция trim(char*, int), где вторым параметром указывается с какой стороны удалять пробелы(0 - с обеих сторон)
+86
new Date(System.currentTimeMillis());
Просто и со вкусом
+144
function LeapYear(intYear) {
if (intYear % 100 == 0) {
if (intYear % 400 == 0) { return true; }
}else{
if ((intYear % 4) == 0) { return true; }
}
return false;
}
Пистец %)
надыбал скриптец в проекте при чистке. Так индусы считали високостный год %))
походу сразу %4 не работает %) или тут зарыт какой-то мэйджик смысл? %) ы
+170
var a1 = Math.floor(Math.random()*15 + 1);
var a2 = Math.floor(Math.random()*15 + 1);
mismatch(2);
var a3 = Math.floor(Math.random()*15 + 1);
mismatch(3);
var a4 = Math.floor(Math.random()*15 + 1);
mismatch(4);
var a5 = Math.floor(Math.random()*15 + 1);
mismatch(5);
var a6 = Math.floor(Math.random()*15 + 1);
mismatch(6);
var a7 = Math.floor(Math.random()*15 + 1);
mismatch(7);
var a8 = Math.floor(Math.random()*15 + 1);
mismatch(8);
var a9 = Math.floor(Math.random()*15 + 1);
mismatch(9);
var a10 = Math.floor(Math.random()*15 + 1);
mismatch(10);
var a11 = Math.floor(Math.random()*15 + 1);
mismatch(11);
var a12 = Math.floor(Math.random()*15 + 1);
mismatch(12);
var a13 = Math.floor(Math.random()*15 + 1);
mismatch(13);
var a14 = Math.floor(Math.random()*15 + 1);
mismatch(14);
var a15 = Math.floor(Math.random()*15 + 1);
mismatch(15);
Это и многое другое на http://ru.wikiversity.org/wiki/15_puzzle
+162
/*
Макрос генерирует внутренности функции-заглушки OpenGL.
*/
#define BWT_DECLARE_OPENGL_PROC_IMPL(PROC, PROC_TYPE, ...) \
static PROC_TYPE _##PROC = 0; \
\
if (_##PROC) \
return _##PROC(__VA_ARGS__); \
else \
{ \
_##PROC = TryToGetProcAddress<PROC_TYPE>(#PROC); return _##PROC(__VA_ARGS__); \
}
/*
Функция получает адрес функции, или возбуждает исключение, если адрес получить не удалось.
*/
template<typename proc_type>
proc_type TryToGetProcAddress(const char *proc_name) throw(error_type<VIDEO>)
{
proc_type address = reinterpret_cast<proc_type>(::SDL_GL_GetProcAddress(proc_name));
if (!address)
BWT_THROW_VIDEO_ERROR(UNDEFINED_ERROR, "OpenGL version does not supported");
return address;
}
GLAPI void APIENTRY glCullFace (GLenum mode)
{
BWT_DECLARE_OPENGL_PROC_IMPL(glCullFace, PFNGLCULLFACEPROC, mode);
}
...
+144
void addSlash( const char* command, char* sdo )
{
int command_length;
char *command_line = command;
command_length = strlen(command);
while(command_length>0){
switch(*command_line){
case '"':
strcpy(sdo+strlen(sdo),"\\");
default:
strcpy(sdo+strlen(sdo), command_line);
}
command_line++;
command_length--;
}
}
Должно быть добавление слешей перед двойными кавычками.