- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
class CRenderWindow
{
public:
/***/
bool IsWindow();
/***/
};
class CWindow : public CRenderWindow
{
/***/
};
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+20
class CRenderWindow
{
public:
/***/
bool IsWindow();
/***/
};
class CWindow : public CRenderWindow
{
/***/
};
Код для работы с окнами. Лишнее я убрал (весь код занимает больше 500 строк).
О чем думал человек, который это проектировал? О_о
+27
String MyClass::ConvertToString(int i)
{
switch(i)
{
case 71:
return String::Format("%s", "ab703d2");
case 72:
return String::Format("%s", "ab70382");
case 73:
return String::Format("%s", "ab7038c");
case 74:
return String::Format("%s", "ab70396");
case 79:
return String::Format("%s", "ab703be");
case 80:
return String::Format("%s", "ab703c8");
case 82:
return String::Format("%s", "ab703dc");
case 86:
return String::Format("%s", "ab703fa");
case 75:
return String::Format("%s", "ab703a0");
case 77:
return String::Format("%s", "ab703aa");
case 83:
return String::Format("%s", "ab703e6");
case 84:
return String::Format("%s", "ab703f0");
case 78:
return String::Format("%s", "ab703b4");
case 87:
return String::Format("%s", "ab70404");
case 90:
return String::Format("%s", "fe8c33d");
case 93:
return String::Format("%s", "fe8c35b");
case 91:
return String::Format("%s", "fe8c347");
case 92:
return String::Format("%s", "fe8c351");
case 81:
return String::Format("%s", "fe8c329");
case 85:
return String::Format("%s", "fe8c333");
default:
return String::Format("%s", "1a177fd");
}
}
Фиг с ними, с массивами. Но Format() то зачем???
+22
static bool GetPathToExecutable( std::wstring & sPath )
{
#ifdef WIN32
std::vector<wchar_t> TmpData;
#else
std::vector<char> TmpData;
#endif
static const size_t _nResize = 256;
try
{
TmpData.resize( _nResize );
}
catch( ... )
{
sPath.clear();
return false;
}
while( true )
{
#ifdef WIN32
DWORD iSize = GetModuleFileNameW( NULL, &TmpData[0], (DWORD) TmpData.size() - 1 );
if( GetLastError() == NO_ERROR )
{
sPath.assign( &TmpData[0], iSize );
return true;
}
else if( GetLastError() != ERROR_INSUFFICIENT_BUFFER )
{
//
// Unsupported error
//
break;
}
#else
int iSize = readlink( "/proc/self/exe", &TmpData[0], (int) TmpData.size() - 1 );
if( iSize < 0 )
{
//
// Error is occurred
//
break;
}
if( iSize < TmpData.size() - 1 )
{
//
// Store value
//
return LConv::ConvertCharToWstring( sPath, &TmpData[0] );
}
#endif
try
{
TmpData.resize( iSize + _nResize );
}
catch(...)
{
break;
}
}
sPath.clear();
return false;
}
коллега инициализит строку
+19
Lennart lennart=new Lennart;
Надпись жёлтым цветом на гпавном меню minecraft.
+38
SkinDog* crateDog()
{
return reinterpret_cast<SkinDog*>( new Dog() );
};
void deleteDog( SkinDog* pDog)
{
delete reinterpret_cast<Dog*>( pDog );
}
EvilDog::bite()
{
Dog* pDog = mutationDog();
Не удержался, чтоб не запостить. Сами знаете откуда.
+41
int sheeps(int pole[10][10])
{
int i,j,f,k,r;
int rand_chislo, rand_chislo1, ts,s;
srand(time(NULL));
for (i=0;i<10;i++)
for (j=0;j<10;j++)
pole [i][j]=0;
do{ f=0;
rand_chislo = 0 + rand() %10;
rand_chislo1= 0 + rand() %10;
ts = 1+rand()%4;
if (ts==1) {for(i=0;i<3;i++) if(rand_chislo==i)f=1;}
if (ts==2) {for(i=7;i<10;i++) if(rand_chislo==i)f=1;}
if (ts==3) {for(i=0;i<3;i++) if(rand_chislo1==i)f=1;}
if (ts==4) {for(i=7;i<10;i++) if(rand_chislo1==i)f=1;}
}
while (f==1);
switch (ts){
case 1: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo-1][rand_chislo1]=1;
pole[rand_chislo-2][rand_chislo1]=1;pole[rand_chislo-3][rand_chislo1]=1; break;
case 2: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo+1][rand_chislo1]=1;
pole[rand_chislo+2][rand_chislo1]=1;pole[rand_chislo+3][rand_chislo1]=1; break;
case 3: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo][rand_chislo1-1]=1;
pole[rand_chislo][rand_chislo1-2]=1;pole[rand_chislo][rand_chislo1-3]=1;break;
case 4: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo][rand_chislo1+1]=1;
pole[rand_chislo][rand_chislo1+2]=1;pole[rand_chislo][rand_chislo1+3]=1; break; }
for (k=0;k<3;k++)
{
do{ f=0;
rand_chislo = 0 + rand() %10;
rand_chislo1= 0 + rand() %10;
ts = 1+rand()%4;
if (ts==1) {if(rand_chislo!=0){ for (i=rand_chislo-2;i<rand_chislo+2;i++)
for (j=rand_chislo1-1;j<=rand_chislo1+1;j++)
{if (pole[i][j]!=0){f=1;}}}else f=1; }
if (ts==2) {if (rand_chislo!=9) { for (i=rand_chislo-1;i<=rand_chislo+2;i++)
for (j=rand_chislo1-1;j<=rand_chislo1+1;j++)
{ if (pole[i][j]!=0){ f=1;}}}else f=1; }
if (ts==3) { if (rand_chislo1!=0) { for (i=rand_chislo-1;i<=rand_chislo+1;i++)
for (j=rand_chislo1-2;j<=rand_chislo1+1;j++)
{ if (pole[i][j]!=0){ f=1;}}}else f=1; }
if (ts==4) { if (rand_chislo1!=9) { for (i=rand_chislo-1;i<=rand_chislo+1;i++)
for (j=rand_chislo1-1;j<=rand_chislo1+2;j++)
{ if (pole[i][j]!=0){ f=1;}}}
else f=1; }
}
while (f==1);
switch (ts){
case 1: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo-1][rand_chislo1]=1; break;
case 2: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo+1][rand_chislo1]=1; break;
case 3: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo][rand_chislo1-1]=1;break;
case 4: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo][rand_chislo1+1]=1; break; }
}
for (k=0;k<2;k++)
{
do{ f=0;
rand_chislo = 0 + rand() %10;
rand_chislo1= 0 + rand() %10;
/*зесь еще 2 таких же while (if==1) и for k<3 и k<4 */
return pole[10][10];
}
курсовик первокурсника "морской бой". функция расстановки кораблей
+11
clEnqueueReleaseGLObjects(queue, objects.size(), objects.data(), 9, NULL, NULL);
В целом ничего страшного, но почему на клавиатуре девятка так рядом с нулём?
+28
std::size_t _;
std:size_t __;
http://ideone.com/Ie1AY
+20
#include <iostream>
#include <string>
#include <stdio.h>
#include <time.h>
int main()
{
time_t now = time(0);
struct tm tstruct = *localtime(&now);
if (tstruct.tm_yday & 0xff) {
std::cout << "Pasony, segodnja den' programmista!"<< std::endl;
} else {
/*Syscall platform dependent implementation */
//KeepCoding();
}
return 0;
}
ВНЕЗАПНО: http://tinyurl.com/c8kkxl8
+35
// стоит простая задача: удалить все узлы из списка
// чувак думает, как же ему это реализовать через задницу?
// и получилось же!
if (link * root = list.get_root()) {
link * next;
do {
next = root->next();
list.remove(next);
} while (root = next);
}
// неужели нельзя вот так, по-простому?
link * node = list.get_root();
while (node) {
link * next = node->next();
list.remove(node);
node = next;
}