Hi everybody,
I'm an engineering student. Hee i would like to discuss about some basic and simple C++ interviews questions. I thnk the persons interested in it will participate. Ok can i ask one question?
What are the differences between C language and C++ language?

Ok, crys u had agood question. Can i help you?
Ok i will try my best.
First of all C language is a subset of C++ language.And C provides action,structure and function oriented pprogramming,but C++ provides object oriented programming with some features like encapsulation,abstraction,inheritance and polymorphism etc..

Thank you tom. You have given the very correct answer. And C++ supports sophisticated error handling using the exception handling mechanism.And C++ is a strong type checking language compared to C.
Next question is What are the advantages of using cin and cout compared to scanf(..) and printf(...) rpv?

Hi crys,
This question also very nice one..
I thnk,compared to the standard C function printf() and scanf(),the usage of cin and cout is more type_safe.In function scanf() we need to provide '&' before variable and if we miss this it can cause more damages. And cin and cout are stream classes that could de used to recieve and print objects respectively.

Hi ithelp...you are very very correct. Tom also said so....If C is a subset os C++, then C++ is the superset of C language. Both of you are said the same thing in different ways. Do u have any more idea about the advatages of using cin and cout compared to printf() and scanf()?

C++ is object oriented, supports data encapsulation, inheritance , generic programming. printf,scanf cannot be overloaded where as >> and << can be overloaded

c and c++ are different because c++ is an object oriented programming which use classes while c is a procedural programing. c++ is an enhance version of c.

Do u have any more idea about the advatages of using cin and cout compared to printf() and scanf()?

Personally I think the c++ implementation of cout is absolutely horrible. In its simplest for cout is pretty easy to use, but get really complicated when you want nicely formatted code such as specifying field widths. printf() on the otherhand is compact and easy to learn. printf() beats the pants off cout every time.

>>What are the differences between C language and C++ language?
There are lots of differences and C99 made even more. Here is a discussion of them.

My oppinion is the next one.
I call C with C. :D
But C++ i call C with class.

My oppinion is the next one.
I call C with C. :D
But C++ i call C with class.

Huh? Would you like to try to say that again :)

Yes, you can call C functions with c++, but can not call c++ functions that require c++ classes with C. The two languages are not compatible.

The two languages are not compatible.

But if i have g++ compailer it is compatible.

But if i have g++ compailer it is compatible.

No they are not. Read the link I posted earlier about the differences between the two languages. You can not always compile a C program with a c++ compiler without making some changes. One simple example: char *ptr = malloc(255); . That will compile with C but not C++.

printf() beats the pants off cout every time.

In what, user-friendliness? cout and cin are much more safer than
printf. Most of the time cout is easier to format than printf; In my
opinion of course. I see that you are a c guy?

This article has been dead for over six months. Start a new discussion instead.