Void and clrscr

I am confused with this code, I got this tutorial from internet.

I dont understand how to use void, and the compiler say that clrscr is not declared on variable. Whats wrong?

Thanks

1
2
3
4
5
6
7
8
9
10
11
  #include <iostream>
#include <cstdio>
#include <conio.h>

void main()
{
    clrscr();
    cout << "Hello world \n";

    getch();
}


closed account (z05DSL3A)
The problem with a lot of 'tutorials from internet' is that they are crap.

If that is an example of code from the tutorial, find another.

http://www.cplusplus.com/doc/tutorial/
www.learncpp.com is also good
That code looks like it was written for an ancient version of the Borland compiler.
void main() is simply not valid code.
The other functions and <conio.h> are non-standard and may or may not exist for a given compiler.
To add to what Chervil said: why not just print a lot of '\n's to the console and reset the cursor?
lmsmi1 wrote:
why not just print a lot of '\n's to the console and reset the cursor?

I don't think he would be here if he knows how to do that. so?
Topic archived. No new replies allowed.