Borland C++ Version 6 problem

I just downloaded Borland C++ version 6 because my old compiler was giving alot of problems. I made this programme just to test the compiler and it giving declaration syntax error. Please help !

#include <iostream>
#include <conio>

int main

{
cout<<"This is it.";


getch();


}
remove conio.h because you don't need the getch(); replace it with return 0;

[EDIT]
you must put parenthesis () after main in int main.
so your code goes like this:
1
2
3
4
5
6
#include <iostream>
int main()
{
          cout<<"This is it.";
          return 0;
}
 


Last edited on
Oh yeah. I forgot to put ()

I put them and that error is gone. But is giving this error ( Undefined symbol 'cout')
Have you tried putting in the namespace you're using for cout - e.g. std::cout?
Is there actually borland version 6 ? I thought the last version was 5.5.
or you can do this:

#icnlude <iostream>
#using namespace std; //this will help to recognize cout in the statement.
int main ()

{
cout << "This is it.";
return 0;
}

two statements:
std::cout
using namespace std;

perform same task, as in

If you have seen C++ code before, you may have seen cout being used instead of std::cout. Both name the same object: the first one uses its unqualified name (cout), while the second qualifies it directly within the namespace std (as std::cout).

cout is part of the standard library, and all the elements in the standard C++ library are declared within what is a called a namespace: the namespace std.

In order to refer to the elements in the std namespace a program shall either qualify each and every use of elements of the library (as we have done by prefixing cout with std::), or introduce visibility of its components. The most typical way to introduce visibility of these components is by means of using declarations:






using namespace std;


The above declaration allows all elements in the std namespace to be accessed in an unqualified manner (without the std:: prefix).
All compilers with the word "Borland" in the name are ancient, pre-standard programs. Download a modern compiler. See this for useful links. http://www.cplusplus.com/articles/j8hv0pDG/

I recommend you look at the IDE options, like Code::Blocks.

Hope this helps.
Topic archived. No new replies allowed.