Current time: 11-25-2024, 05:26 AM
Need help with PL
#1
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.
[Image: nines.jpg]
Reply
#2
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.
Reply
#3
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 >_< )
[Image: nines.jpg]
Reply
#4
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.
Reply
#5
Hmm ok thanks, so if I use

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

its should be fine?
[Image: nines.jpg]
Reply
#6
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?
Reply
#7
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
[Image: nines.jpg]
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)