Monday, July 18, 2011

Basic Difference Between C and C++

  1. In C language programming, we use "#inlude<stdio.h>" while in C++ programming language, we use "#include<iostream.h>".
  2. In C language programming, we use format specifiers for printing any variable on the screen but in C++ programming language we do not use format specifiers.

              for example
                     In C language  
                                      printf("the value of variable = %d",num);
                     In C++ language 
                                      cout<<"the value of variable ="<<num;
          
      3.  We use "Cout<<"text";" in C++ language while in C language, we use "printf("text");" for printing something on the output screen.
      4. We use "cin>>"variable name";" in C++ language while in C language, we use "scanf("format specifiers,&variable name");" for taking input from the screen.                                 
      5.There is additional "endl" function in C++ programming language for new line although you can use "\n" for new line as we used in C language for new line.

No comments:

Post a Comment