Wednesday, October 13, 2010

Software Engg:Introduction to Programming:Operators

Lecture No : 07
Topic : Final Description About Operator and Some Introduction to Move Forward  to C++ i.e Difference Between C and C++

Truth in C

In C, an expression statement always resolves to a single value. “if” statements test for truth. If an expression resolves to true, the if statement acts “Truth” in C is any non-zero value ONLY zero is considered false in C



 Basic Rational Operators

Basic Relational Operators can be used in C to make “if” statement conditions more useful. The 6 Basic Relational Operators are
>  <  >=  <=  ==  !=
    (greater than, less than, greater than or equal to, less than or equal to, equal to, not equal to)


 Basic  Logic Operators
Basic Logic Operators can be used to combine more than one condition in an “if” statement or invert the result of a condition. The 3 Basic Logic Operators are
&&   ||    !
 (and, or, not)


 Operators Types
  • The relational operators <,>,<=,>=,==, and != are called binary operators, because they require 2 operands
  • The logical operators && and || are also binary operators. The logical operator! Is called a unary operator, because it takes only one operand


 Code Blocks
Code Blocks are used at a high level to define functions (like main). Code Blocks can also be used to show conditional code, like that belonging to an “if” or “if/else” statement. Code Blocks MUST be used if more than one instruction is dependent on the “if” or “else” clause:

  Learning Example 1 of Code Block
Learning Example 2 of Code Block


 Block Diagram of Code Block

 Topic of Discussion Changed
Lets find out Differences Between C and C++

The main difference between C & C++  is the OOPS technology, C++ is an object oriented programming language, using which one can program using the objects that are been created.  C++ have the provision of inheritance, constructors whereas you will not find these in C. Still C is better than C++ because of its  easy and understandable syntax.
  
Factual Differences Between C and C++

The C differ from c++ in these things :
  • The input /output in the c ( use printf , for the out and scanf for the input ).
  • In c use #include<stidio.h>  , but in the c++ use #include <iostream>.
  • In the c CAN NOT use the string type but you can declare  it as an array .
  • Also there are some deffereant  in function how write the function and how to call the function.
 General Differences Between C and C++

“A lot of C remains in C++. Although not actually being more powerful than C”. C++ allows the programmer to more easily manage and operate with Objects, using an OOP (Object Oriented Programming) concept. C++ applications are generally slower at runtime, and are much slower to compile than C programs. The low-level infrastructure for C++ binary execution is also larger. For these reasons C is always commonly used even if C++ has a lot of popularity. Probably continue to be used in projects where size and speed are primary concerns, and portable code still required.

Webmaster Note:-
This is ALL about the INTRODUCTION TO PROGRAMMING for any further queries and books and reference books feel free to contact me and email me. I will respond u as early as possible.


No comments:

Post a Comment