This is too funny

http://www.cplusplus.com/articles/i86AC542/

First reaction: Obvious troll is obvious.
Then, I visited his website.
Seems like an early 2000's site.
He ACTUALLY HAS that program for sale. (check the "Check Register" program)

Is this a very elaborate trolling move?
Last edited on
Never before, was the past so alive.
I thought that Articles were reviewed and approved before becoming visible.

Besides my distaste for his coding methods, the numerous links to his external site just drips of self-indulgent advertising. And the one-vote 5-star rating?

There needs to be a 'report' button for Articles.
Hehe that was me :)
Does anybody else feel like re-installing Borland C? I know I do.

Edit: I gave him 5 stars too, in recognition for the effort.
Last edited on
Yeah he obviously was a C programmer. I've never seen so many arrays in my life.
His website isn't that bad, at least it's not one of those 90s ones with the 3D red bullet points, American flags, rotating GIFs everywhere with the <blink> and <marquee> tags all over the place.

BHXSpecter wrote:
Yeah he obviously was a C programmer. I've never seen so many arrays in my life.

Hey... :(
So how much can we improve it (i.e. completely rewrite it)? Points for (lack of) size, elegance, cool C++11 stuff and wit.
closed account (10oTURfi)
5 star as well. I wish all trolling was like that...
Either a genius troll or a terribly amusing attempt at a programmer.

Either way, it made me smile.
chrisname wrote:
Hey... :(

No disrespect meant. Just saying I would have probably used an array of strings rather than C-Strings. Can't imagine how much of a pain that was to keep straight.
"this is C++ code from underneath a pushbutton on a data entry screen for editing data for a checkbook register program i made for an actual customer of mine."

How can C++ code be underneath anything but a license?
Do data entry screens ever not edit data?
Can he have written a longer run-on sentence with a lowercase I in it?
Is he suggesting that sometimes he writes code for fake customers of his?
Will this post consist only of a quote and questions following it?
Are you wondering where I am going with this?
Have you considered decaf?
How can C++ code be underneath anything but a license?
Do data entry screens ever not edit data?
Can he have written a longer run-on sentence with a lowercase I in it?
Is he suggesting that sometimes he writes code for fake customers of his?
Will this post consist only of a quote and questions following it?
Are you wondering where I am going with this?
Have you considered decaf?

Why are there so many questions, and yet so few answers?
Or does an answer lie within its question?
What else?
Why?
lol... either way it made me laugh
I saw this a couple days ago and thought that writing this program would be a fun little challenge.

After I was done, I decided to make the code as obfuscated and difficult to follow as possible, and here is the finished result! Nothing fancy from the 2011 standard though.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#define sstr substr
#include <iostream>
#include <string>
void print(std::string);
std::string l(std::string);
std::string strw(int);
int get(char);
int main(int argc, char *argv[]) {
	for(int i=1; i<argc; i++) print(argv[i]);
	return 0;
}
void print(std::string s) {
	std::string t=s, str="", a=strw(0), b;
	while(t[0]=='0') t.erase(0,1);
	while(t.find(",")!=std::string::npos) t.erase(t.find(","),1);
	int d=t.find("."); 
	bool r=(t[0]=='$'), j=((d!=(int)std::string::npos)?true:false);
	if(r) t=t.sstr(1,t.size()-1);
	d=t.find(".");
	a=t.sstr(0,((int)t.size()-1<d)?t.size():d);
	if(d!=(int)std::string::npos) b=(t.sstr(d+1)+"0").sstr(0,2);
	int k=20;
	for(int i=a.size()-1; i>1; i=i-3) {
		if(a.sstr(i-2,3)!="000") str=l(a.sstr(i-2,3))+strw(247)+strw(get(char(k+48)))+strw(247)+str;
		k=k+(k<=23?1:0);
	}
	d=(a.size()%3);
	if(d!=0) str=l(a.sstr(0,d))+strw(247)+strw(get(k+48))+strw(247)+str;
	if(str.empty()) str=strw(get((char)48))+(char)32;
	if(r) str+=strw(145);
	while(str.find(strw('{'*2))!=std::string::npos) str.erase(str.find(strw('{'*2)),1);
	if(str==strw('h'+'1')) str=str.sstr(0,str.size()-1);
	if(j) {
		if(b!="0"&&b!="00") str+=strw('A'+'d')+l(b)+(r?(strw('d'+'G')):"");
		else if(r) str+=strw('Y'*2);
		else str+=strw(165)+strw(0);
		if(str.find(strw('a'*2))!=std::string::npos&&str.find(strw('f'*2))==std::string::npos) str=str.sstr(0,str.size()-1);
	}
	if(str.sstr(str.size()-1,1).compare(strw(247))==0) str=str.sstr(0,str.size()-1);
	while(str.find(strw('{'*2))!=std::string::npos) str.erase(str.find(strw('{'*2)),1);
	std::cout << (char)toupper(str[0]) << str.sstr(1,str.size()-1) << ".\n";
}
std::string l(std::string s) {
	std::string str="00"+s;
	char a=str[str.size()-1], b=str[str.size()-2], c=str[str.size()-3];
	str=std::string(((a-48!=0)?strw(get(a)):""));
	if(b-48==1) {
		if(((int)a-48)<6) str=strw(get(a+10));
		else	str=strw(get(a))+strw(219+(((a-48)%8)?0:1));
	}
	else if(b-48!= 0) {
		if(((int)b-48)<6) str=strw(get(b+14))+std::string(((a-38)%10)?(strw(224)+str):"");
		else {
			if(((int)b-48)!=8) str=strw(get(b))+strw(230)+std::string(((a-38)%10)?(strw(224)+str):"");
			else str=strw(get(b))+std::string(((a-38)%10)?((strw(236)+strw(224))+str):strw(236));
		}
	}
	if(c-48!=0) str=strw(get(c))+strw(247)+strw(238)+strw(247)+str;
	if(str=="") return strw(0);
	else return str;
}
std::string strw(int n) {
	int nn['S'+'T'+'R'] = {  122, 101, 114, 111, 123, 111, 110, 101, 123, 116,  
	119, 111, 123, 116, 104, 114, 101, 101, 123, 102, 111, 117, 114, 123, 102, 
	105, 118, 101, 123, 115, 105, 120, 123, 115, 101, 118, 101, 110, 123, 101, 
	105, 103, 104, 116, 123, 110, 105, 110, 101, 123, 116, 101, 110, 123, 101, 
	108, 101, 118, 101, 110, 123, 116, 119, 101, 108, 118, 101, 123, 116, 104,
	105, 114, 116, 101, 101, 110, 123, 102, 111, 117, 114, 116, 101, 101, 110, 
	123, 102, 105, 102, 116, 101, 101, 110, 123, 116, 119, 101, 110, 116, 121, 
	123, 116, 104, 105, 114, 116, 121, 123, 102, 111, 114, 116, 121, 123, 102, 
	105, 102, 116, 121, 123, 116, 104, 111, 117, 115, 197, 110, 100, 123, 109, 
	105, 108, 108, 105, 111, 110, 123, 198, 105, 108, 108, 105, 111, 110, 123, 
	100, 111, 108, 108, 197, 114, 115, 123, 111, 110, 101, 132, 100, 111, 108, 
	108, 197, 114, 115, 123, 132, 197, 110, 100, 132, 123, 132, 199, 101, 110, 
	116, 115, 123, 132, 197, 110, 100, 132, 122, 101, 114, 111, 132, 199, 101, 
	110, 116, 115, 123, 111, 110, 101, 132, 199, 101, 110, 116, 115, 123, 145, 
	111, 110, 101, 132, 199, 101, 110, 116, 115, 123, 101, 101, 110, 123, 116,
	101, 101, 110, 123, 145, 123, 116, 121, 145, 123, 116, 121, 123, 121, 145,
	123, 121, 123, 104, 117, 110, 100, 114, 101, 100, 123, 132, 132, 123  };
	if(nn[n]!='N'*2-'!') return (char)((nn[n]>='{')?nn[n]-'d':nn[n])+strw(n+1);
	else	return "";
}
int get(char a) {
	int n=('n'-'V');
	int nn[24] = { 0, 5, 9, 13, 19, 24, 29, 33, 39, 45, 50, 54, 61,
			 	68, 77, 86, 94, 101, 108, 114, 119, 120, 129, 137 };	
	return nn[a-n*2];
}


Gets the job done in under a hundred lines and with only two arrays.
Oh no, my precious neurons!
closed account (10oTURfi)
So this is your entry for IOCCC?
Last edited on
Oh my.
Topic archived. No new replies allowed.