|
-
November 6th, 2002, 07:49 PM
#11
Member
Okay, this should be a very simple solution to your problem:
Since you're using C, you can forget about <IOstream.h>. It's for C++, so just leave it for now. The "cout << "Hello World"" is also a C++ command, so we'll forget about that too ( for now ).
Heres a simple program that should run perfectly for you:
Code:
#include <stdio.h> // This is the standard header file for the C language
#include <conio.h> // This header contains the getch() function.
void main() {
printf("Hello World!");
getch(); // This function will wait for you to press a key before ending the program
}
Optionally, you can also add the line "clrscr(); " above "printf". This will clear the console screen for you before printing "Hello World!".
Hope this answers the question. 
(Okay, I apologize. This post was supposed to be a part of the previous one.. oh well heh)
And now, to convert that same little program to C++.
The Hello World program in C++ will look like this for you, y2k:
Code:
#include <iostream.h>
#include <conio.h>
void main(){
cout << "Hello World!";
getch();
}
Again, getch() will make the prgram wait until you press any key on the keyboard. And once again, adding clrscr() before the "cout" statement will clear the console screen for you.
Cheers. heh
I blame you cos my mind is not my own, so don't blame me if I trespass in your zone!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|