First program a disaster...

Hello all,

I have always been into the tech side of things...networks / pc's etc.

but used to program basic on my cbm64 when i was like 10.

felt like i was lacking on the creative side of computing. so i picked up
C++ for dummies 5th edition...is it any good as a starting point? (Maybe you guys in this fine community can send me in a better direction)

anyways...

i copied a tempreture program from the book and pasted it into my compiler.
im using dev+ 4.9.9.2 but all iget is errors.

when the author said it should run...he then creates an error after compiling the program to show you...but i get an error immediatly.

is it possible that his dev+ is older?

this shouldnt be happening should it?

any info appreciated...
I have a C++ book similar to the one you've bought and I've come to realize that a lot of the syntax the author uses is usually old and outdated or is missing key components.

For instance, here's some code from my book:
1
2
3
4
5
6
7
8
9
10
#include <iostream>
#include <stdlib.h>

int main (int argc, char *argv[]) {

cout<< "Hello world" <<endl;

system ("PAUSE");
return 0;
}


When it's supposed to be:
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
#include <cstdlib>

using namespace std;

int main (int argc, char *argv[]) {

cout<< "Hello world" <<endl;

system ("PAUSE");
return 0;
}


You may want to look up some more recent C++ programming tutorials and use a mixture of your book and the online help.
Last edited on
Dev C++ is no longer maintained and is usually bundled with an out of date compiler. What platform are you coding on?

I've found the "For Dummies" books to generally be, well, not very good.

What errors are you getting?
Try Code::Blocks. Even when it was supported, Dev-C++ was a little too simple and lacked features that make programs like Visual Studio handy, such as Intellisense. Code::Blocks doesn't have Intellisense, but it's great for someone who can't afford Visual Studio (or who isn't a student and can't get it for free, :P)
ok Moschops thanks for the advice...can you reco a good book/compiler for a newb...

thanks all for answering

oh yes, im using windows 7
Last edited on
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
using namespace std;

int main ()
{

cout<"My first c++ program"<<endl;

system("pause");
return 0;
}
< -> <<

I just like lines of symbols :p
< -> << = \m/; :P
Last edited on
@kyon What are you pulling there? (haha with the \m/ I imagined a drowning dude with an m head)

on another note: Janian, is there a particular reason you aren't doing this:

1
2
3
4
5
6
#include <iostream>
using namespace std;
int main(){
  cout <<"My Output To The Console\n"; // <- notice the  first << and for that matter the \n
  cin.get(); // or something (I don't like the system method)
}


edit: nvm flame wars are fine =)
Last edited on
edit: nvm flame wars are fine =)


They are? Ace. DEATH TO THE PURVEYORS OF SYSTEM! =p
LIFE TO THE ANTITHESIS OF THE NON-PURVEYORS OF THE SYSTEM!!

it has begun
Topic archived. No new replies allowed.