Zelaron Gaming Forum

Zelaron Gaming Forum (http://zelaron.com/forum/index.php)
-   Tech Help (http://zelaron.com/forum/forumdisplay.php?f=329)
-   -   Unmanageable C++ code (http://zelaron.com/forum/showthread.php?t=23267)

Chruser 2003-10-14 09:33 AM

Unmanageable C++ code
 
// Example #1: Compilable pseudocode

#include <iostream.h>
#include <stdlib.h>
#define twelve 12
#define onethousantthreehundredandthirtyseven 1337
#define semicolon ;
#define first_off struct ___{
#define do_this int _ semicolon int __ semicolon
#define do_that } semicolon
#define then void main(){
#define do_more ___ test={twelve,onethousantthreehundredandthirtyseven } semicolon test._+=5 semicolon cout << test._ << endl semicolon
#define and_more for(semicolon semicolon){ cout << ++test.__ << endl semicolon
#define the }
#define end }

first_off

do_this
do_that

then
do_more
and_more

the end

Chruser 2003-10-14 09:35 AM

// Example 2: Tricky variable names and screwed up color coding

#include <iostream.h>
#include <fstream.h>

void main(){

int _,__,___,____;
/*cin >> __;*//**//*/*//*/*/
__=1403;__-=1337;

ofstream _____;
_____.open("C:\\__");

for(_=__;_;((__--&&_--)&&___--)&&____--)
_____ << /*/*//**/(char)/*(const double)(const float)*//**/(const int)(((_&&__&___&____)));

_____.close();

}

Titusfied 2003-10-14 09:44 AM

Quote:

Originally Posted by Chruser
/*cin >> __;*//**//*/*//*/*/


_____ << /*/*//**/(char)/*(const double)(const float)*//**/(const int)(((_&&__&___&____)));

Well, I know very little about C++, but I'm a little confused with these lines... What are you trying to accomplish there? Why are you putting your "cin" as a comment?

Also, I think you need to define more libraries, but I really don't know.

Medieval Bob 2003-10-14 11:50 AM

When I try to compile it them on the College's omega server, It's not seeing any libraries "iostream.h" or "fstream.h."

Why's that?

BlueCube 2003-10-14 05:00 PM

This is the first one, as far as I can figure out (only 1 year of C++, like 3 years ago).


Code:



#include <iostream.h>
#include <stdlib.h>

struct WierdVarType {int A; int B;};

void main()
{


  WierdVarType test={12,1337};
  test.A += 5;
  cout << test.A << endl;


  for(;;)  /*Yay for infinite loops*/
      {
        cout << ++test.B << endl;
      }

}



...

So would the output be:

17
1338
1339
1340
1341
1342
1343
1344
(and so on)

I'm not quite sure. I think the ++test.B would increment before it prints out on screen.

Unless I screwed it up and it doesn't compile..

Hmm.. seems I need more C++ classes!

Hades-Knight 2003-10-14 05:52 PM

WTF CHRUSER YOUR PROGRAMMIN STYLE TEH SUX!!!!!!!


you putn int = x,x,x,x;? WHat kind of nigger programmer are you man?

you have to do it

int x;
int x;
etc
int

Titusfied 2003-10-14 06:13 PM

No, you line up "int" the way he did it. I saves time, looks neater, and much faster to type out.

Hades-Knight 2003-10-14 06:25 PM

problably =(...im force to do it in the waterfall style =*(

Chruser 2003-10-15 01:13 PM

Quote:

Originally Posted by Hades-Knight
problably =(...im force to do it in the waterfall style =*(

Why do it the "waterfall style" when you can make things stylish? For instance:

#include <iostream.h>
#define sp <<endl<<

const double main(){

int a,b,c,d;
a=b=c=d=123;
cout << a sp b sp c sp d << endl;
return 0;
}

D3V 2003-10-17 10:17 AM

I tried to learn some C++ last year, I sort of gave up on it, I was getting good with that and HTML, I quit C++ but went on with HTML, I need to start back up with it....

WetWired 2003-10-17 10:31 AM

Quote:

Originally Posted by Medieval Bob
When I try to compile it them on the College's omega server, It's not seeing any libraries "iostream.h" or "fstream.h."

Why's that?

IIRC, these are AP classes: they aren't standard, and they're supposed to help teach C++. Yeah right, like confusing students as to what the bitshift opperator does really helps them, or shielding them from standard C null-terminated strings helps them. IMNSHO, the AP classes are bullshit. You won't have them in the real programming world, so why the fuck do you have to learn to use them to take the advanced placement tests? In my three years as a professional, I have not once benefited from the time I spent learning to use the AP classes.


All times are GMT -6. The time now is 06:06 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.