C++ is better C , it supports data encapsulation , inheritance , generic programming ,etc .

Hello,
I am little bit confuse for c and c++. All loops are same in both the languages so why they are different for each other?

you will find the same similarities in most computer languages and that makes it easy to learn several different languages.

You should rather refer to some good book inorder to remove the elementary confusions.
C++ is an object-oriented version of C.
You can also call it as an enhanced version of C (just in regard to syntax and keywords) .
However, as far as coding style matters, only certain syntactic similarities remain - such as loops. Otherwise, C++ possesses a whole new concept of data encapsulation, inheritance, generic programming, etc., which C certainly doesnt provide.

>All loops are same in both the languages so why they are different for each other?
Why is Perl different from C++? They both have a for loop with the same syntax.

1) Comparing the syntax of a single feature isn't a good way to compare languages.
2) C++ is designed to have a subset that's interchangeable with C. To a large extent, that design goal has been successful, which is why the loops in both languages are virtually identical in syntax and semantics.

>C++ is the object-oriented version of C.
That's a rather naive perspective. C++ is multi-paradigm, meaning it isn't just object oriented, or generic, or procedural, it's all of them, depending on your tastes and needs.

> C++ is a OO oriented version of C.
>> That's a rather naive perspective. C++ is multi-paradigm, meaning it isn't just object oriented, or generic, or procedural, it's all of them, depending on your tastes and needs.

You are right. I just meant to emphasize on the prime and major use of C++, which i think is OO and generic programing.

>which i think is OO and generic programing.
Bolded for emphasis. Too often people state an opinion and word it as if it were a fact. Sometimes it's intentional, sometimes not, but it's nearly always misleading.

How would you explain it to some one who knows nothing about computers because i know the difference but I have to hand in a paper that asks us what the difference is and it says you have to make it so simple that a four year old can understand so anyone have any ideas on how to get an A.
Sorry for making a bigger question out of it.

>it says you have to make it so simple that a four year old can understand
That's probably exaggeration, but I would say that C++ is based on C with lots of extra stuff and a few changes.

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