C++

Open discussion about any topic, as long as you abide by the rules of course!
inphlict
Posts: 1656
Joined: Sat Jul 13, 2002 7:00 am

C++

Post by inphlict »

I would like to take another stab at C++ and I was wondering if anyone here knows any good online resources or beginner books. I know a lot of the basics but I have forgotten most of them so I need to relearn it all. :(
Guest

Post by Guest »

I used to frequent a couple good sites but I forgot em :(

I'd be interested in finding some too though.
bork[e]
Posts: 4357
Joined: Tue Mar 23, 2004 8:00 am

Post by bork[e] »

Here is a few of the best imo.
Shmee
Posts: 501
Joined: Mon Feb 14, 2005 11:50 pm

Post by Shmee »

Deitel and Deitel - clear, concise - requires rudimentary understanding of programming concepts but little else. They are great teachers IMO.
[color=red]You're Pretty When I'm Drunk[/color]
dnoyc
Posts: 354
Joined: Wed May 16, 2001 7:00 am

Post by dnoyc »

deitel is garbage.
the sam's series is pretty good.
tnf
Posts: 13010
Joined: Tue Mar 13, 2001 8:00 am

Post by tnf »

I have a lot of books, deitel's and sam's and the old giant C++ programmers bible...i used bits and pieces out of all of them to produce my hello world program. It's pretty slick.
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

#include <iostream>int main(){std::cout<<"Hello, world!\n";}

?
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

C, not C++, but still rather amusing...

Code: Select all

#define A B.
#define C if( 
#define D >>E&1
#define F return
#define G typedef
#define H printf( I(
#define J(E,K) for(E=K; E--; )
#define L(M) =N(O.M)+3*N(O.M&O.P),
G
int
Q;
G
unsigned
R;
G
struct
{
Q
N,
S,
P,
T,
U,
V;
}
W;
R
_;
R
N(
R
X)
{
R
Y=
2,
Z;
for
(;
 Y
;
Y*=
Y)
{
Z=
-1
/-
~Y
;
X=
(X
/Y
&Z
)+
(X
&Z
)*
(Y
*_
-~-
_)
;
}
F
X;
}
W
S(
W
a)
{
W
B;
_=
1;
A
N=
N(
a.
S)
;
A
S=
N(
a.
N)
;
A
P=
N(
a.
P)
;
A
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(
A
V=
1<<
30
);
for
(b
=4
;
e<
65536
&&
b<
20
;
b++
){
Z=
(o
&1
?f
(B
,m
,b
,-
2)
:d
(B
,b
))
.T
;
}
o&
1?
H"	 }	{ }  		 "
),
Z>>
5&
3^
3)
:H
"	 }	{ } 	   } }	{ }  		 "
),
32
-(
Z&
31
),
Z>>
5&
3^
3)
;
}
}
B=
V(
B,
Z)
;
g=
o;
C
_)
{
o|=
1;
m=
A
T;
}
else
{
o=
o/
2*
2^
4;
}
C
g<
4)
{
B=
S(
B)
;
}
}
}
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

Or else this gem...

Code: Select all

#include <stdio.h>
#define PO(o,t)\
(((o>64)&&(o<91))?(((t>96)&&(t<123))?(t-32):(t)):(((t>64)&&(t<91))?(t+32):(t)))

      void main() {                                       char *poo= "poot",
      *Poo="pootpoot"      ,O[9];int      o,t,T,p;(t=p   =0)||(*O='\0');while
      ((o=       getc(   stdin   ))!=(   EOF))if  ((p==   0)&& (((o>64 )&& (
      o<91       )) ||   ((o>     96 )   &&(o<     123)        ))) (
      t!=8       )&&(O   [t]=     o)&&   (O[++     t] =        '\0')
      ;else {if (t>7)    {for     (T =   0 ; T     <=7;        T++ )
      printf("%c",       PO(*(   O+T),   *(Poo+   T)));       printf
      ("%c",              o);}else if     (t>3){for (T        =0;T<=
      3;T++)                                                  printf
      ("%c",                                                  PO(*(O
      +T),*(                                                  poo+T)

) ) ; printf( "%c" , o ) ; } else  printf ( "%s%c" , O , o )  ; ( t =  0 ) || (
* O =  '\0' ) ; ( o == 60 ) && ( ++p ) ; ( o == 62 ) && (p!=0) && ( --p ) ; } }
4g3nt_Smith
Posts: 711
Joined: Sun Feb 15, 2004 8:00 am

Post by 4g3nt_Smith »

Code: Select all

#include <sys/types.h>
#include <unistd.h>
int main (int argc, char *argv[]) 
{ 
  while(1) 
  { 
    fork(); 
  } 
  return 0; 
}
Compile and run it.
stocktroll
Posts: 1314
Joined: Mon Mar 21, 2005 2:44 am

Post by stocktroll »

while yall are so clever..... .
one trick way to get some basics is see if you can leach off the website of a university/tech school programming class for a structured run through and try to do their programming assignments and tests
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

4g3nt_Smith wrote:

Code: Select all

#include <sys/types.h>
#include <unistd.h>
int main (int argc, char *argv[]) 
{ 
  while(1) 
  { 
    fork(); 
  } 
  return 0; 
}
Compile and run it.
The good, old fork bomb :) However, any modern *NIX allows the sysadm to hard-limit the maximum number of processes per user.
U4EA
Posts: 2894
Joined: Sun Nov 26, 2000 8:00 am

Post by U4EA »

There's actually a competition where you have to produce a working application (according to predefined specs) but you have to make the code as arcane as possible. Some of the entries were downright scary. Don't remember where I read about it, but I'm sure a google search would turn up something.
mik0rs
Posts: 2650
Joined: Wed May 03, 2000 7:00 am

Post by mik0rs »

bork[e] wrote:Here is a few of the best imo.
Pretty unique google reference actually, kudos :up:
mik0rs
Posts: 2650
Joined: Wed May 03, 2000 7:00 am

Post by mik0rs »

dnoyc wrote:deitel is garbage.
the sam's series is pretty good.
I've not had any real problems with the Deitel book, but I completely agree on the Sams thing, the ASP.NET book I used for something was good.
diego
Posts: 1379
Joined: Mon Jan 24, 2005 12:25 pm

Post by diego »

I started out with Kernighan/Richie's "C"-book and finished off with Stroustrups "C++"-book. I never looked back, it widened my horizon.
User avatar
PhoeniX
Posts: 4067
Joined: Fri Aug 04, 2000 7:00 am

Post by PhoeniX »

I have dietel somewhere: to be honest I found it not very good, in terms of being quite hard to understand. I tend to just google problems instead, or browse some lecture notes.
User avatar
PhoeniX
Posts: 4067
Joined: Fri Aug 04, 2000 7:00 am

Post by PhoeniX »

I also had This as a basic intro into the language, and to be honest, although some reviews don't like it, I thought it was the easiest way to understand how to use C++ and it made things very easy too
bitWISE
Posts: 10704
Joined: Wed Dec 08, 1999 8:00 am

Post by bitWISE »

You might want to look into C# as well. I kind of like it and the fact you can use it for ASP as well as applications is pretty cool.
diego
Posts: 1379
Joined: Mon Jan 24, 2005 12:25 pm

Post by diego »

Plus, its syntax is very nice and good-looking... to me at least.
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

U4EA wrote:There's actually a competition where you have to produce a working application (according to predefined specs) but you have to make the code as arcane as possible. Some of the entries were downright scary. Don't remember where I read about it, but I'm sure a google search would turn up something.
http://www.ioccc.org/

Those snippets I posted are entries from the 90s :)
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

bitWISE wrote:You might want to look into C# as well. I kind of like it and the fact you can use it for ASP as well as applications is pretty cool.
Sure, tie yourself down to a single platform (CLR).
bitWISE
Posts: 10704
Joined: Wed Dec 08, 1999 8:00 am

Post by bitWISE »

^misantropia^ wrote:
bitWISE wrote:You might want to look into C# as well. I kind of like it and the fact you can use it for ASP as well as applications is pretty cool.
Sure, tie yourself down to a single platform (CLR).
Sure, inphlict is going to be developing cross platform applications and he barely knows C++.
inolen
Posts: 707
Joined: Thu Dec 16, 1999 8:00 am

Post by inolen »

bitWISE wrote:You might want to look into C# as well. I kind of like it and the fact you can use it for ASP as well as applications is pretty cool.
Why learn a language that is only practical for select purposes?
dnoyc
Posts: 354
Joined: Wed May 16, 2001 7:00 am

Post by dnoyc »

besides if you know c++ you can pretty much code in c#, the converse is not true.
Post Reply