The Raven Republic Forums
Need help with PL - Printable Version

+- The Raven Republic Forums (https://ravenrepublic.net/forums)
+-- Forum: Miscellaneous (https://ravenrepublic.net/forums/forumdisplay.php?fid=59)
+--- Forum: Tech (https://ravenrepublic.net/forums/forumdisplay.php?fid=50)
+--- Thread: Need help with PL (/showthread.php?tid=1315)



Need help with PL - Black Dragon - 03-05-2008

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/lab1/lab1task1.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.


RE: Need help with a program (visual C++ 6) - Grim - 03-05-2008

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:

Code:
#include <iostream>

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.


RE: Need help with a program (visual C++ 6) - Black Dragon - 03-05-2008

I found the problem! In fact I felt stupid, I kept on choosing Win32 App, instead of Win32 Console App Chair 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 >_< )


RE: Need help with a program (visual C++ 6) - Grim - 03-05-2008

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.


RE: Need help with PL - Black Dragon - 03-05-2008

Hmm ok thanks, so if I use

Code:
#include<stdio.h>
void main()
{printf("Hello World!");
getch();
}

its should be fine?


RE: Need help with PL - Grim - 03-05-2008

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?


RE: Need help with PL - Black Dragon - 03-05-2008

Sorry, I don't have either, damn prof made me research Turbo C LOL 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! Smile