 Here is a man dumbo which do not perform task
by himself. So we have to give him command and
then he will perform it.
 Similarly , the computer also can’t perform task by
himself until we give him some set of instruction
to perform(command).
 So, computer take some INPUT form user perform
some COMPUTATION then give useful
INFORMATION or DATA.
COMPARING DUMBO WITH
COMPUTER :
#include <iostream>
using namespace std;
int main()
{
/* program code */
return 0;
}
A modern-style C++ program that uses the new-style
headers and a namespace -
#include <iostream>
using namespace std;
int main()
{
/* program code */
return 0;
}
 The new-style headers do not specify filenames.
 They simply specify standard identifiers that might
be mapped to files by the compiler, but they need
not be.
 <iostream>
 <vector>
 <string>, not related with <string.h>
 <cmath>, C++ version of <math.h>
 <cstring>, C++ version of <string.h>
 Programmer defined header files should end in “.h”.
•Computer consist of:
•Main Memory
•Registers
•ALU
•Input
•Output devices
•Disk
•Bus ,etc .
•NOTE: The data is always copied if we take any variable (data)
and perform some operation on it. So there will we always a
GARBAGE VALUE present at address or memory location.
•Computer uses only binary language to perform ANY task or to
store any data.
 In c++ we can use int data type to store a integer
value.
 Int uses 4 byte or 2 byte to store data.
 There are some data type which are used with in to
store data which required less or more storage,
they are:
 Short-2byte
 long-8byte
 unsigned-numbers with positive values only.
 Range = -2^31 to 2^31-1
Example: data type – int – size=4byte(32bits)
Formula:
1.)For signed -2^n to 2^n-1 .
2.)For unsigned 0 to 2^2n -1 .
Here n=number of bits.
n= 32,
-2^32 to 2^32-1 or
0 to 2^64-1 .
•In computer the signed interger is stored in
the form of binary numbers.
•The positive numbers from 0 to infinity the
number will be in its complement form.
• The MSB will 0 for positive and 1 for
negative.
•The remaining part of negative number will be
in its 2’s complement.
1. If the number is starting with 0 then the
number will be in octal.
2. If the number is starting with 0x then the
number will be in hexadecimal.
3. We can define a constant by using const.
•To represent floating numbers in c++ the float
and double data types are used .
•Float – 4byte – 7 digits.
•Double – 8byte – 15 digits.
•To represent string there are three data types
available in c++, they are:
•1. string
•2. char
•3. bool (true or false).
•For every character there is a ASCII value
•E.g. : ‘A’=65 , ‘a’ =97 , ‘0’ =48 etc.
•Range of char= 0 to 255.
•E.g. : char x=‘a’ ;
•In string data type the string “harsh” will be
stored in the from of array .
•E.g. : string =“HARSH”;
•Also,
•E.g. : char arr[6]=“HARSH”;
•Here ‘0’ is the NULL string which signify the
end of the string.
•In boolean, bool data type store only true-1 or
false-0.
H A R S H 0
#include directives
int main()
{
constant declarations;
variable declarations;
executable statements;
return 0;
}
•Compiler directive or Header file : Instruction
to compiler used when compiling our program
to machine language.
•For e.g. iostream , math, etc.
•Using namespace std : every declaration in the
program is stored in a namespace called “std”.
•E.g. std:: name; if declaration is of name.
•We can also our own namespace , when
required.
•Is state that the value(result) of arithmetic
operation depend on more expressive variable.
•E.g. : float a,b;
c=a+b; will be float.
c=a-b; will be float.
c=a/b; will be float……..,etc.
Similarly, 2-2.0 will be float.
Precedence : Operator :
1. ( )
2. *
3. + or -
4. / or %
NOTE : Do not use [] or {} rather than of ().
E.g. : a+b*c/d-e == (a+((b*c)/d))-e
 Escape character ----- ‘’.
•It is use to escape the use of a character if we
put ‘’ in front of a character then the value is
escaped.
•Like if we want to print “ on console then we
have to use ” .
•Similarly ,  ,etc.
•Also to print % on console we have to use
%%.
Precedence : Operators:
1. !
2. < , <= , > , >=
3. == , !=
4. &&
5. ||
•In for( ) or while( ) loop : if there is nothing
then it will assume 1 means it will run the
content of for or while loop.
•For E.g. for(i =0 ; ; i++) ,while( ) ,etc.
•In C++, we can use static members inside a
structure i.e., struct .
•We can also print the address on printf
statement like, printf(“%p”, ” hello world”);
This will print the address on the string.
c++

c++

  • 3.
     Here isa man dumbo which do not perform task by himself. So we have to give him command and then he will perform it.  Similarly , the computer also can’t perform task by himself until we give him some set of instruction to perform(command).  So, computer take some INPUT form user perform some COMPUTATION then give useful INFORMATION or DATA. COMPARING DUMBO WITH COMPUTER :
  • 4.
    #include <iostream> using namespacestd; int main() { /* program code */ return 0; }
  • 5.
    A modern-style C++program that uses the new-style headers and a namespace - #include <iostream> using namespace std; int main() { /* program code */ return 0; }
  • 6.
     The new-styleheaders do not specify filenames.  They simply specify standard identifiers that might be mapped to files by the compiler, but they need not be.  <iostream>  <vector>  <string>, not related with <string.h>  <cmath>, C++ version of <math.h>  <cstring>, C++ version of <string.h>  Programmer defined header files should end in “.h”.
  • 8.
    •Computer consist of: •MainMemory •Registers •ALU •Input •Output devices •Disk •Bus ,etc . •NOTE: The data is always copied if we take any variable (data) and perform some operation on it. So there will we always a GARBAGE VALUE present at address or memory location. •Computer uses only binary language to perform ANY task or to store any data.
  • 9.
     In c++we can use int data type to store a integer value.  Int uses 4 byte or 2 byte to store data.  There are some data type which are used with in to store data which required less or more storage, they are:  Short-2byte  long-8byte  unsigned-numbers with positive values only.  Range = -2^31 to 2^31-1
  • 10.
    Example: data type– int – size=4byte(32bits) Formula: 1.)For signed -2^n to 2^n-1 . 2.)For unsigned 0 to 2^2n -1 . Here n=number of bits. n= 32, -2^32 to 2^32-1 or 0 to 2^64-1 .
  • 11.
    •In computer thesigned interger is stored in the form of binary numbers. •The positive numbers from 0 to infinity the number will be in its complement form. • The MSB will 0 for positive and 1 for negative. •The remaining part of negative number will be in its 2’s complement.
  • 12.
    1. If thenumber is starting with 0 then the number will be in octal. 2. If the number is starting with 0x then the number will be in hexadecimal. 3. We can define a constant by using const.
  • 13.
    •To represent floatingnumbers in c++ the float and double data types are used . •Float – 4byte – 7 digits. •Double – 8byte – 15 digits.
  • 15.
    •To represent stringthere are three data types available in c++, they are: •1. string •2. char •3. bool (true or false). •For every character there is a ASCII value •E.g. : ‘A’=65 , ‘a’ =97 , ‘0’ =48 etc. •Range of char= 0 to 255. •E.g. : char x=‘a’ ;
  • 16.
    •In string datatype the string “harsh” will be stored in the from of array . •E.g. : string =“HARSH”; •Also, •E.g. : char arr[6]=“HARSH”; •Here ‘0’ is the NULL string which signify the end of the string. •In boolean, bool data type store only true-1 or false-0. H A R S H 0
  • 17.
    #include directives int main() { constantdeclarations; variable declarations; executable statements; return 0; }
  • 18.
    •Compiler directive orHeader file : Instruction to compiler used when compiling our program to machine language. •For e.g. iostream , math, etc. •Using namespace std : every declaration in the program is stored in a namespace called “std”. •E.g. std:: name; if declaration is of name. •We can also our own namespace , when required.
  • 19.
    •Is state thatthe value(result) of arithmetic operation depend on more expressive variable. •E.g. : float a,b; c=a+b; will be float. c=a-b; will be float. c=a/b; will be float……..,etc. Similarly, 2-2.0 will be float.
  • 20.
    Precedence : Operator: 1. ( ) 2. * 3. + or - 4. / or % NOTE : Do not use [] or {} rather than of (). E.g. : a+b*c/d-e == (a+((b*c)/d))-e
  • 21.
     Escape character----- ‘’. •It is use to escape the use of a character if we put ‘’ in front of a character then the value is escaped. •Like if we want to print “ on console then we have to use ” . •Similarly , ,etc. •Also to print % on console we have to use %%.
  • 22.
    Precedence : Operators: 1.! 2. < , <= , > , >= 3. == , != 4. && 5. ||
  • 23.
    •In for( )or while( ) loop : if there is nothing then it will assume 1 means it will run the content of for or while loop. •For E.g. for(i =0 ; ; i++) ,while( ) ,etc. •In C++, we can use static members inside a structure i.e., struct . •We can also print the address on printf statement like, printf(“%p”, ” hello world”); This will print the address on the string.