Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Borland C++ vs Standard C++

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi guys, what is the difference bewteen Borland C++ and Standard C++? I am currently learning how to program C++ reading a book called Standard C++. However i cannot go beyond the first page of the book cause the following code below will not run.

#include <iostream>

int main()
{ int i =10, j=20;
int k = (i+j)/2;
std::cout << &quot;i is &quot; <<i
<< &quot; and j is &quot; << j << std::endl;
std::cout << &quot;average is &quot; << k
<< std::endl;
return 0;
}

the error msg is &quot;Qualifier 'std' is not a class or namespace name.&quot; I do know that standard C++ is a standard language that is not owned by any of the major compiler developers. Does that mean that Borland C++ 5.02 cannot support the std::cout functions? Shouldn't such compilers support Standard C++? Why is there such differences? makes learning C++ so difficult for a newbie like me.:(

Also wat is the difference between Borland C++ 5.02 and Borland Turbo C++ 4.5? Why is one called Turbo C++ and the other is not? Will Turbo C++ 4.5 support std::cout?

Lastly, is it possible to program plain old C programs using a C++ compiler? how do i do that and if C++ is a superset of C then y shld pple learn C anymore?

Sorry for so many questions and it would be great if somone could help me with these questions.

Thanks,

John
 
after #include put
using namespace std; John Fill
1c.bmp


ivfmd@mail.md
 
Does that mean that Borland C++ 5.02 cannot support the std::cout functions? Shouldn't such compilers support Standard C++? Why is there such differences? makes learning C++ so difficult for a newbie like me. At the time 5.02 was written, it did support the &quot;standard.&quot; That was several years ago. At the time, the C++ committee was working revising the standard. The committee &quot;froze&quot; that standard in 1998 (I think). Any compiler released before that time isn't fully compliant. See my comments on your other thread. Unless you need a compiler for DOS, I would suggest you upgrade to 5.5. It's free and much more compliant than 5.02.

One note: 5.5 is the same compiler in Borland C++ Builder 5 but 5.5 does not come with the RAD (rapid application developement) IDE that Builder has.

Also wat is the difference between Borland C++ 5.02 and Borland Turbo C++ 4.5? Why is one called Turbo C++ and the other is not? Will Turbo C++ 4.5 support std::cout? The &quot;Turbo&quot; compilers are (for the most part) even older that the &quot;Borland&quot; compiler. I believe they were called &quot;Turbo&quot; because Borland had a full line of very fast (turbo) compilers. They also came out with the &quot;Borland&quot; compilers for &quot;professionals&quot;. Somewhere around WFW or 95, Borland dropped the &quot;Turbo&quot; name. You can get more information by going to .

Lastly, is it possible to program plain old C programs using a C++ compiler? how do i do that ... Most C++ compilers are C compliant. Some compilers look at the extention on the program source code (.c vs .cpp) to determine whether to compile in C or C++. Others have switches when you compile it. I don't remember how 5.02 did it.

... if C++ is a superset of C then y shld pple learn C anymore? That question is likely to start a religious war. There is still a lot of older C code out there. The C committee is also working on updating its standard, too, so C won't go away soon. There are a lot of people out there who say that newbies should stick to C++ and not learn C and there are a lot out there who say they should. This is a question that most likely cannot be answered by anyone but you.
James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
Thank you all very much for taking the time to explain and answer my questions. Particularly to James, sorry that you had to type so much but it really helped a great deal. :)

Thanks once again.

John
 
That's why we are here. ;-)
James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
hi there,

BC++ 5.02 has a very powerful compiler n IDE. if u want to compile above code change ur node type to CppCompile n extension to *.cpp n all'll be right then.

Borland C++ is some what enhanced n proprietry compiler then standard C++. it fully support standard library functions as well as its own functions that r not part of standard library.

Turbo series is some what old compilers of borland then &quot;Borland series &quot; compilers.

n ur last question..... yes u can compile 16bit n 32bit apps using borland c++ 5.02 compiler easily. just change node types n some project properties n u got compiled app for ur required plateform. u can use bc++ 5.02 to compile to c or cpp. its very user friendly. but try using bc++ 5.5 compiler. its without IDE but its more enhanced n powerful then bc++ 5.02. bc++5.5 is basically bc++ builder compiler, an RAD tool from borland.

hope that this small chunk of material has been satisfied u to some extent.

ComputerJin
 
#include <iostream.h> Let's u compile without the std::
 
Try

#include <iostream>

int main()
{ int i =10, j=20;
int k = (i+j)/2;
cout << &quot;i is &quot; <<i
<< &quot; and j is &quot; << j << endl;
cout << &quot;average is &quot; << k
<< endl;
return 0;
}
:: is normally used when declaring a member of a class.
Once that is done ( cout is declared in iostream.h ) you
don't do it again, you just use it. I'm a little rusty with
standard C as I use Borland's C++ Builder but I believe that's the correct explanation. (If not I bet I'll hear about it ) :->) <- smilely with a mustache, ha ha!


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top