what is the main difference between c and c++?

Answer Posted / raman sharma

in c is structual language and c++ is a object oriented
language. in c we use #include<stdio.h> and in c++ we use
#include<iostream.h>. in c we single line comment /* /* and
in c++ we use // //. in c we use manipulator and in c++ we
dont use manipulator because in c++ there is a one header
file we use #include<iomanip.h>. in c++ there is
class,object,encapsulation,inheritance,message
binding,polymorphism etc and in c there is no class and
object. in c++ we use endl in line break also \n but in c
programming there is only \n we use. there is constructor
and disgustor. in c++ is easy and less complexity program.
in c there is use printf() for output and scanf()for input
and c++ there is cout<< for output and cin>> for input and
<< is insertion and >> is a extraction this is main
differece between in c and c++

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are properties in oop?

606


Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box

2027


How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction

1652


What are classes oop?

596


i am getting an of the type can not convert int to int *. to overcome this problem what we should do?

1833






write a code for this. serial_number contained in the header of the file will be read , if this serial number is less than a previous serial number within a successfully processed file, or is the same as another serial number within a successfully processed file, or if the field contains anything other than 7 digits, then the file must error with the reason ‘Invalid SERIAL_NUMBER’.

1776


What is polymorphism give a real life example?

557


What does oop mean in snapchat?

680


What is ambiguity in inheritance?

621


This program numbers the lines found in a text file. Write a program that reads text from a file and outputs each line preceded by a line number. Print the line number right-adjusted in a field of 3 spaces. Follow the line number with a colon, then one space, then the text of the line. You should get a character at a time and write code to ignore leading blanks on each line. You may assume that the lines are short enough to fit within a line on the screen. Otherwise, allow default printer or screen output behavior if the line is too long (i.e., wrap or truncate). A somewhat harder version determines the number of spaces needed in the field for the line numbers by counting lines before processing the lines of the file. This version of the program should insert a new line after the last complete word that will fit within a 72-character line.

1635


What is balance factor?

580


Question In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Question Submitted By :: Sunil Kumar I also faced this Question!! Rank Answer Posted By Re: In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Answer # 1 use copy constructors 0 Shanthila There is something to be taken care in destructor, in copy constructor, suppose the memory is assigned to the embedded member object pointer with the parameter passed value, but if some other objects of different class also are pointing to this memory, then if some one deletes the object then this class member pointer object will become dangling, or if the object is not deleted properly then there will be memory leak. Please suggest the design change required to handle or avoid this situation

1656


Do you know about multiple inheritance?

637


What is overriding in oop?

548


i=20;k=0; for(j=1;k-i;k+=j<10?4:3) { cout<

1413