Posts: 685
Threads: 18
Joined: Aug 2006
03-05-2008, 09:14 AM
(This post was last modified: 03-05-2008, 09:53 AM by Black Dragon.)
I need help I have this as source code:
# include iostream.h
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
I'm following steps on this one:
http://www.cse.ust.hk/~weiwei/lab102/lab...task1.html
Weird thing, whenever I build this thing, there are 2 errors. Funny thing though, it says file doesn't exist whenever I execute the program.
Pls. reply as soon as possible T_T It feels like I'm in a different world when I use Visual
BTW that stdio.h has brackets on each side, but since it thinks it's HTML, I remove them.
Posts: 7,110
Threads: 210
Joined: Aug 2006
Steam: Grimlo9ic
Epic: Grimlo9ic
Battle.net: Grim#16773
03-05-2008, 09:21 AM
(This post was last modified: 03-05-2008, 09:44 AM by Grim.)
Dude, when posting code here put it in between the
code tags so it doesn't mess things up.
Now, on to your question,
Black Dragon Wrote:Code:
# include <iostream.h>
I think the .h is already deprecated? It should work fine with:
EDIT: Although since it's VC++6, the .h may be needed after all. Not sure.
Your code straight compiles and works fine for me. What IDE are you using? And are you using the MingW compiler? Personally I use Bloodshed's
Dev-C++ 5 (the beta). It's more current, I believe.
Posts: 685
Threads: 18
Joined: Aug 2006
I found the problem! In fact I felt stupid, I kept on choosing Win32 App, instead of Win32 Console App
Thanks for the help though :p
Next question Turbo C and Turbo C++ is almost the same right? So is it fine in Turbo C using the same simple Hello world program ?
(oh yeah, there is a code tag, sorry there >_< )
Posts: 7,110
Threads: 210
Joined: Aug 2006
Steam: Grimlo9ic
Epic: Grimlo9ic
Battle.net: Grim#16773
Black Dragon Wrote:Next question Turbo C and Turbo C++ is almost the same right? So is it fine in Turbo C using the same simple Hello world program ?
Well C++ is an expansion of the C language so I would say that there will be some incompatibilities when writing code.
C is much closer to assembly language in form.
Posts: 685
Threads: 18
Joined: Aug 2006
Hmm ok thanks, so if I use
Code:
#include<stdio.h>
void main()
{printf("Hello World!");
getch();
}
its should be fine?
Posts: 7,110
Threads: 210
Joined: Aug 2006
Steam: Grimlo9ic
Epic: Grimlo9ic
Battle.net: Grim#16773
Don't have any C compilers with me right now, so I can't say for sure, sorry. There's nothing wrong with trying it out, right?
Posts: 685
Threads: 18
Joined: Aug 2006
Sorry, I don't have either, damn prof made me research Turbo C
Well anyway thanks for the advices! It helps out a lot (especially on that C is more on Assembly Language)
I'll need these info in my defense later, thanks again!