Ok so ive strted to try and teach myself C++ cause in a few years when i go to college i wanna study computer science or engineering.

I downloaded Dev C+++ and followed some small simple tuts on how to do C++.

2 of the tuts started off simple and i followed them exactly the same as in the videos n book.

Each time i try it it doesnt work. My code is correct to my knowledge and all that happens is the applicaion just flashes on and off.

Here is a video of it happining http://s240.photobucket.com/albums/ff13/dennis13579/?action=view&current=clip0002.flv

but crappy quality so this is what the code is

#include <iostream.h>

int main ()
{
cout<< "Hello World";
system("PAUSE");
return(0);
}

any help pleaseeeeee

How about try this code:

#include <iostream>

int main()
{
   std::cout << "Hello World";
   std::cin.get();
   return 0;
}

Assuming you downloaded an up to date version of Dev-C++ you might try something like this:

#include <iostream>
using namespace std;

int main ()
{
  cout<< "Hello World"; 
  cin.get();
  return 0;
}

If that works, and I think it will, then the problem is that the tutorial is out of date, and not a problem with the compiler.

EDIT: My fingers need to train for the Olympics so I can type faster!

Thanks for all the help guys but i tried both of your codes and it still did the same thing =(

i just downloaded Dev C++ like 2 days ago. it should be the newest version. i could be wrong?

**Edit**

I just remade another console application and tried again with the code provided from you two and it works. tanks a bunch.. now one more question

this is the default code that starts when i do console app.
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
system("PAUSE");
return EXIT_SUCCESS;
}


what would i change to change the text of the app to say hello world??

Edit: you have editted during I was replying.
Anyway, you can simply use our code.

change this:

{
system("PAUSE");

to this;

{ 
   cout << "Good bye!";
   system("Pause");

For future reference it's considered best to avoid system() calls when possible. That's why both Invisal and I used cin.get(); instead.

Umm, system() calls don't work on all platforms... you can use cin.get() but i think it executes every time you press enter so you might need an army of those.
for example:

#include <iostream>

int main( void ) 
{
    int a; std::cin >> a;
    std::cout << a;
    
    std::cin.get();
    return 0;
}

i personally use
scanf( "\n" ); it's a function from <stdio.h> / <cstdio> and seems to be included in <iostream> it simply waits forever for you to press enter...just enter a value and press enter to kill. it's only used if you don't run from cmd anyways.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.