1. Originally Posted by Mario F.
Of course, this new type CClass is an oddity since it becomes possible to write things like:

+val = 13;
I'd say it's an oddity because it overides opperator+() at all. For large object it would makes sence to return a reference, instead of copying the object, unless the object is changed when operator+ is called.

2. Okey, my turn now:

Code:
```y > x ?
x >= 0 && y <= 1 :
x <= 1 && y >= 0```
And my other still not solved problem in a reduced form:
Code:
```const double h = 0.001;
std::complex<double> z(1.0, 0.0), f(1.0, h);
int i = 0;
do {z *= f; i++;} while (imag(z) > 0);
printf("%1.9lf\n", i*h - imag(z)/real(z));```

3. I answered two of these so Here's mine.

Write this function without recusion. (Thereby making apparent what the function does.)
Code:
```char whatDoIDo(char (*func)(char, char), char a, const char * xs)
{
return *xs ? whatDoIDo(func, func(a, *xs) , xs+1) : a;
}```

4. Originally Posted by TriKri
Aha, it is the maximum number of characters an integer type itype can require! I didn't see the definition was a macro until I noticed the \ sign, hehe. So I guess 12655/42039 is an approximation of log(2) then, it's pretty close.
Bingo.

Originally Posted by TriKri
Okey, my turn now:

Code:
```y > x ?
x >= 0 && y <= 1 :
x <= 1 && y >= 0```
Result is true if x and y are in [0,1], false otherwise; an obfuscated way of writing this?
Code:
`(x == 0 || x == 1) && (y == 0 || y == 1)`
Originally Posted by TriKri
And my other still not solved problem in a reduced form:
Code:
```const double h = 0.001;
std::complex<double> z(1.0, 0.0), f(1.0, h);
int i = 0;
do {z *= f; i++;} while (imag(z) > 0);
printf("%1.9lf\n", i*h - imag(z)/real(z));```
An approximation of pi?

5. The below two programs are based on a common theme.

Code:
```unsigned i, j;
for(i = 64; i; --i) {
for(j = 0; j < 64; ++j)
putchar("-#"[!(i - 1 & j)]);
putchar('\n'); }```

This one is completely incomprehensible. The program is summarized in a one-word C-style comment which makes the last line exactly 80 characters long ("10-letters" is a placeholder); you can try guessing it instead

Code:
```int main(){char*c=calloc(102,1);++c;*c+=8;while(*c){--*c;--c;*c+=4;c+=2;*c+=4;++
c;++*c;c-=2;}c+=2;*c+=2;++c;*c+=2;c-=4;while(*c){--*c;while(*c){--*c;++c;++*c;--
c;}++c;while(*c)--*c,++c,putchar(*c),c-=2,++*c,++c;c+=3;while(*c){--*c;while(*c)
--*c,++c,++*c,--c;++*c;++c;while(*c){--c;++*c;++c;*c+=7;while(*c)--*c,++c,*c+=6,
--c;++c;--*c;putchar(*c);--*c;while(*c)--*c,--c,*c+=2,++c;--c;putchar(*c);while(
*c){--*c;}}*c+=2;--c;while(*c)--*c,++c,--*c,--c;*c+=2;++c;while(*c){--c;--*c;++c
;*c+=7;while(*c)--*c,++c,*c+=4,--c;++c;putchar(*c);putchar(*c);while(*c)--*c;--c
;}c+=2;}++*c;c-=3;while(*c){--*c;while(*c){--*c;++c;++*c;--c;}++*c;++c;while(*c)
{--*c;--c;++*c;c+=3;--*c;while(*c)--*c,++c,++*c,--c;*c+=2;++c;while(*c)--*c,--c,
--*c,++c;c-=3;}c-=4;}c+=2;putchar(*c);c-=3;}getchar();return 0;}/* 10-letters */```
It makes several nonportable assumptions: unsigned default char or two's complement, ASCII, and general reliability of memory alloc. It is, however, written in a small number of simple, easy-to-understand operations, thus increasing its accessibility to beginning programmers.

6. Code:
`( sizeof(itype) * (CHAR_BIT * 12655ul) / 42039 ((itype) -1 < 0) + 1 )`
12655 decimal digits approx. == 42039 bits. CHAR_BIT converts number of bytes (provided by sizeof) to number of bits, but this could as easily be replaced by 8 on most conventional systems. The last part gets the sign; it doubles the original value if the variable is unsigned, meaning it can store twice a larger range. Salem forgot a multiplication operator after 42039. Thus this finds the number of decimal digits attainable in some integral variable type, assuming internal binary representation.

7. > Salem forgot a multiplication operator after 42039
Who? Me?

Quines are pretty mind-bending things

8. > Result is true if x and y are in [0,1], false otherwise; an obfuscated way of writing this?

That's right. No, not really an obfuscated way, just a way I first thought may be faster, but it wasn't...

>
Code:
`(x == 0 || x == 1) && (y == 0 || y == 1)`
No, that wouldn't work, my x and y are floats!

> An approximation of pi?

Yes! An approximation of pi done by simulating a point moving in the complex plane.

9. Originally Posted by jafet
The below two programs are based on a common theme.

Code:
```unsigned i, j;
for(i = 64; i; --i) {
for(j = 0; j < 64; ++j)
putchar("-#"[!(i - 1 & j)]);
putchar('\n'); }```

This one is completely incomprehensible. The program is summarized in a one-word C-style comment which makes the last line exactly 80 characters long ("10-letters" is a placeholder); you can try guessing it instead

Code:
```int main(){char*c=calloc(102,1);++c;*c+=8;while(*c){--*c;--c;*c+=4;c+=2;*c+=4;++
c;++*c;c-=2;}c+=2;*c+=2;++c;*c+=2;c-=4;while(*c){--*c;while(*c){--*c;++c;++*c;--
c;}++c;while(*c)--*c,++c,putchar(*c),c-=2,++*c,++c;c+=3;while(*c){--*c;while(*c)
--*c,++c,++*c,--c;++*c;++c;while(*c){--c;++*c;++c;*c+=7;while(*c)--*c,++c,*c+=6,
--c;++c;--*c;putchar(*c);--*c;while(*c)--*c,--c,*c+=2,++c;--c;putchar(*c);while(
*c){--*c;}}*c+=2;--c;while(*c)--*c,++c,--*c,--c;*c+=2;++c;while(*c){--c;--*c;++c
;*c+=7;while(*c)--*c,++c,*c+=4,--c;++c;putchar(*c);putchar(*c);while(*c)--*c;--c
;}c+=2;}++*c;c-=3;while(*c){--*c;while(*c){--*c;++c;++*c;--c;}++*c;++c;while(*c)
{--*c;--c;++*c;c+=3;--*c;while(*c)--*c,++c,++*c,--c;*c+=2;++c;while(*c)--*c,--c,
--*c,++c;c-=3;}c-=4;}c+=2;putchar(*c);c-=3;}getchar();return 0;}/* 10-letters */```
It makes several nonportable assumptions: unsigned default char or two's complement, ASCII, and general reliability of memory alloc. It is, however, written in a small number of simple, easy-to-understand operations, thus increasing its accessibility to beginning programmers.
I don't think many biginning programmers would get these.

I compiled both on my machine. Very cool. The 10 letter word is Sierpinski. But I still don't get how it's done.

10. Originally Posted by jafet
Code:
```int main(){char*c=calloc(102,1);++c;*c+=8;while(*c){--*c;--c;*c+=4;c+=2;*c+=4;++
c;++*c;c-=2;}c+=2;*c+=2;++c;*c+=2;c-=4;while(*c){--*c;while(*c){--*c;++c;++*c;--
c;}++c;while(*c)--*c,++c,putchar(*c),c-=2,++*c,++c;c+=3;while(*c){--*c;while(*c)
--*c,++c,++*c,--c;++*c;++c;while(*c){--c;++*c;++c;*c+=7;while(*c)--*c,++c,*c+=6,
--c;++c;--*c;putchar(*c);--*c;while(*c)--*c,--c,*c+=2,++c;--c;putchar(*c);while(
*c){--*c;}}*c+=2;--c;while(*c)--*c,++c,--*c,--c;*c+=2;++c;while(*c){--c;--*c;++c
;*c+=7;while(*c)--*c,++c,*c+=4,--c;++c;putchar(*c);putchar(*c);while(*c)--*c;--c
;}c+=2;}++*c;c-=3;while(*c){--*c;while(*c){--*c;++c;++*c;--c;}++*c;++c;while(*c)
{--*c;--c;++*c;c+=3;--*c;while(*c)--*c,++c,++*c,--c;*c+=2;++c;while(*c)--*c,--c,
--*c,++c;c-=3;}c-=4;}c+=2;putchar(*c);c-=3;}getchar();return 0;}/* 10-letters */```
Very hard to debug

Edit: Your first program was very cool, though, I think I'll have to figure out how it works...

11. The latter looks like compiled-to-C version of a brain........ program.
Code:
```>++++++++[-<++++>>++++>+<<]>>++>++<<<<[-[->+<]>[->.<<+>>>]>[-[->+<]+>
[<+>+++++++[->++++++<]>-.-[-<++>]<.[-]]++<[->-<]++>[<->+++++++[->++++<]>..
[-]<]>>]+<<<[-[->+<]+>[-<+>>>-[->+<]++>[-<-+]<<<]<<<<]>>.<<<]```
A lot more compact. I hope I didn't make any mistakes.

12. Omg!

13. Dear lord! *passes out*

14. Ok, a new one in C++:

Code:
```#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main() {
ofstream fout("x.cpp");
if (!fout) {
cout << "Couldn't create \"source.cpp\"" << endl;
system("pause");
exit(1);
}
string s1 = "#include <iostream>\n#include <fstream>\n#include <string>\nusing namespace std;\n\nint main() {\n    ofstream fout(\"x.cpp\");\n    if (!fout) {\n        cout << \"Couldn't create \\\"source.cpp\\\"\" << endl;\n        system(\"pause\");\n        exit(1);\n    }\n    string s1 = \"\", s2, s;\n    int i;\n    for (i = 0; i < s1.size(); i++) {\n        switch (s1[i]) {\n            case '\\\\':\n                 s2 += \"\\\\\\\\\";\n                 break;\n            case '\\n':\n                 s2 += \"\\\\n\";\n                 break;\n            case '\"':\n                 s2 += \"\\\\\\\"\";\n                 break;\n            default:\n                 s2 += s1[i];\n        }\n    }\n    s = s1.substr(0, 260) + s2 + s1.substr(260, 999);\n    fout << s;\n    fout.close();\n    return 0;\n}\n", s2, s;
int i;
for (i = 0; i < s1.size(); i++) {
switch (s1[i]) {
case '\\':
s2 += "\\\\";
break;
case '\n':
s2 += "\\n";
break;
case '"':
s2 += "\\\"";
break;
default:
s2 += s1[i];
}
}
s = s1.substr(0, 260) + s2 + s1.substr(260, 999);
fout << s;
fout.close();
return 0;
}```
Maybe not in the most compact form... (^_^);;

15. Methinks this prints it's own source code, taking into acount // and whatnot. It then writes it out to x.cpp.