- 1
Lennart lennart=new Lennart;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+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;
}
+22
string toString( int i ) {
stringstream s;
s << i;
return s.str();
}
Наткнулся на эту функцию в одном из своих старых проектом.
+29
string input;
string output;
input = "C:\\bla.txt\\"; //"Bla.txt" is the file to copy
output = "C:\\test\\"; //"Test" is the folder to copy to
system("copy input.c_str() output.c_str()")
http://cboard.cprogramming.com/cplusplus-programming/109047-help-copy-files-cplusplus.html
+18
char* GetConnectionName(){return "";}
//---
char* NetworkMgr::getErrorString(int id)
{
if(this->idValid(id))
{
return errors[id];
}
else
{
return "!!!unknown error!!!";
}
}
Из тела одного большого класса, я конечно понимаю что строки хранятся не в стеке, но всеравно.