This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Wednesday, April 16, 2014

c++ escape sequence characters

Escape sequences


Escape sequences are used to define certain special characters within string literals.
The following escape sequences are available:
Escape
sequence
DescriptionRepresentation
\'single quotebyte 0x27
\"double quotebyte 0x22
\?question markbyte 0x3f
\\backslashbyte 0x5c
\0null characterbyte 0x00
\aaudible bellbyte 0x07
\bbackspacebyte 0x08
\fform feed - new pagebyte 0x0c
\nline feed - new linebyte 0x0a
\rcarriage returnbyte 0x0d
\thorizontal tabbyte 0x09
\vvertical tabbyte 0x0b
\nnnarbitrary octal valuebyte nnn
\xnnarbitrary hexadecimal valuebyte nn
\unnnnarbitrary Unicode value.
May result in several characters.
code point U+nnnn
\Unnnnnnnnarbitrary Unicode value.
May result in several characters.
code point U+nnnnnnnn

Example

#include <iostream>
 
void main()
{
    cout<<"aaa"<<"\n"<<"bbb";
getch();
}
Output:
aaa
bbb



c++ Data Type Ranges


Type Name
Bytes
Other Names
Range of Values
int
4
signed
–2,147,483,648 to 2,147,483,647
unsigned int
4
unsigned
0 to 4,294,967,295
__int8
1
char
–128 to 127
unsigned __int8
1
unsigned char
0 to 255
__int16
2
short, short int, signed short int
–32,768 to 32,767
unsigned __int16
2
unsigned short, unsigned short int
0 to 65,535
__int32
4
signed, signed int, int
–2,147,483,648 to 2,147,483,647
unsigned __int32
4
unsigned, unsigned int
0 to 4,294,967,295
__int64
8
long long, signed long long
–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned __int64
8
unsigned long long
0 to 18,446,744,073,709,551,615
bool
1
none
false or true
char
1
none
–128 to 127 by default
0 to 255 when compiled by using /J
signed char
1
none
–128 to 127
unsigned char
1
none
0 to 255
short
2
short int, signed short int
–32,768 to 32,767
unsigned short
2
unsigned short int
0 to 65,535
long
4
long int, signed long int
–2,147,483,648 to 2,147,483,647
unsigned long
4
unsigned long int
0 to 4,294,967,295
long long
8
none (but equivalent to __int64)
–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned long long
8
none (but equivalent to unsigned __int64)
0 to 18,446,744,073,709,551,615
enum
varies
none
See Remarks later in this article
float
4
none
3.4E +/- 38 (7 digits)
double
8
none
1.7E +/- 308 (15 digits)
long double
same as double
none
Same as double
wchar_t
2
__wchar_t
0 to 65,535

Common C++ Errors

1. Programming errors
 These are generated when typographical errors are made by users.

2. Compiler errors 
These are errors detected by the compiler that make the program un-compilable.

3. Linker error
 These are errors generated when the executable of the program cannot be generated. This may be due to wrong function prototyping, incorrect header files.

4. Execution error
 These errors occur at the time of execution. Looping and arithmetic errors falls
under this category.

5. Logical errors
These errors solely depend on the logical thinking of the programmer and are easy to detect if we follow the line of execution and determine why the program takes that path of execution.



Listed below are some common programming errors
1. Misuse of the Include Guard.
A common mistake is to use same symbol in multiple files for #ifndef.
2. Typo's : Using ">" for ">>" and "<" for "<<"
3. Trying to directly access the private variables in the main program.
4. Switch Statments without break.
5. Wrong usage of postfix and prefix operator (diff between i++ and ++i)
6. Undeclared and Unitialised Variables and functions.
7. ALWAYS USE MAKE FILE if you have more than one C++ program. The order of
compilations matters a lot too.
8. Trying to include "INCORRECT" header fuction.
9. Marking a member function as const in the class definition but not in the member function implementation.
10. Returning a value in a void function.

Programming Lanquages

Four concentric circles.  The innermost circle is labeled Machine Language.  The next circle is labeled Assembly Language.  The next circle is labeled Higher Order Language.  The outermost circle is labeled 4 GLs.
Programming languages are used to create software that causes a computer to perform various functions. However, all computer languages can be placed in one of four broad categories which share certain common technical characteristic.These categories also have implications for management and software support as well. These four categories are
  • Machine Language
  • Assembly-Level Language
  • Higher-Order Languages (HOLs)
  • Fourth-Generation Languages (4GLs)

Image of series of the 0 and 1 in a box with the title Machine Language.
  • Machine Languages
    • Digital computers internally represent and process data and instructions as bits. Software coded using this lowest level representation is called a machine language program. First Generation computers were initially programmed using machine languages.
    • Machine languages have many disadvantages
      • Machine language programs are hardware dependent
      • the machine language program for one processor will not work on a different model
      •  Machine language is rarely employed today except for fixes (called patches) to fielded software or, when there is a performance requirement that can not be met by a higher order language.
      • The use of patches should be very strictly controlled and limited to emergency situations.
In the background of the image is a person at a computer.  In the foreground is the title Assembly Level Language.  In the foreground on the bottom right is the text  CLA100 ADD101 and STO102.
  • Assembly-Level Language
    • Assembly language is a mnemonic representation of machine language instructions.
    • Rather than entering the sequence "1101110100110011" to represent a command to the computer to add to numbers, the command "ADD" would be used instead.

    Examples of Higher-Order Language.


    • Higher-Order Languages
      • A general purpose programming language that allows people to write programs without having to understand the inner workings of a computer
      • Translated into a format that a computer can execute (machine language), typically using a computer software tool called a compiler
      • Not unique to a specific brand of computer or a specific computer vendor and, therefore, considered to be highly portable(machine independent)



    •  Translation Process
      • HOLs must be translated into machine language understandable by computer hardware. This translation process is called compilation, and it is done by a complex software tool called a compiler.
    Translation Process diagram

    Source Code
    This translation process starts with the HOL program (called the source code), as written by the programmer. The source code is fed into a sophisticated software tool called a compiler.

    Compiler
    Compilers automatically translate HOL to machine language (compilation). Small programs can take as little as a hundredth of a second to compile while extremely large, very complicated HOL programs can take many minutes to go through a complete compilation process.

    Object Code
    The result of the compilation process is \'\'machine code\'\' or \'\'object code.\'\' The object code is stored in memory and is executed on the computer hardware. As errors are discovered or software upgrades required, source code is changed and the compilation process is repeated.




    Fourth-Generation Languages
    Fourth-Generation Languages (4GLs) gained prominence with the advent of Fourth-Generation computer hardware. 4GLs allow non-technically trained users, as well as professional programmers, to specify the results they want and let the computer determine the specific software instructions needed

    set operatoion



    • Union of set
      • if all elements of A & B are put to gather or form a one set the set form is called union set
        • eg
        • A={1,2,3}
        • B={4,5,6}
          • AUB={1,2,3,4,5,6} [A union B]
    • inter section of set
      • in all elements of A&B which are common to A&B is called intersection
        • eg
          • A={1,2,3,4}
          • B={1,4,5,6}
            • A∩B={1,4} A intersection B

    • different of set
      • the different is" if "A&B"wish is belongs to A and which is not belongs to B"
        • eg
        • A={2,4,6,8}
        • B={1,3,4,7,8}
          • A-B={2,6}
          • B-A={1,3,7}

    About SET


    • equality of two set
      • two set A&B are equal of all element"A elements are found in B&all B elements are found in A"
        • A={1,2,3,4,5}
        • B={1,2,3,4,5}
          • then A=B
    • disjoint set
      • two set A&B are disjoint if the don't have elements in common
        • A={a,b,c}
        • B={1,2,3}
    • finite & infinit set
      • if set has finite numbers of elements it is finite set othervice its an infinite set
        • eg
        • if  M={x|x is positive integer below 100}
          • M={1,2......99}
          • its finite set because there is the end point
        •  if N={x|x is a multiple of 5 and its x>50}
          • N={55,60,65,......~}
          • it is infinite set because we canot say the end point
    • subsets
      • If all elements of set "A" are found in other set "B" then "A" is a  subset of "B" we write this as (AB)
        • eg
        • A={2,4,7}
        • B={1,2,4,6,7,8}                 [AB] proper subset
        • eg2
        • A={2,4,7,8}
        • B={2,4,7,8}                      [AB][B⊂A] equality
    • Null set or empty set
      • a set with no element its called  Nullset or emptyset
        • M={  }   OR M=
    • universal set
      • all sets are under the universal set
      • eg
        • U={a,b,.......,z}=universal
        • A={a,e,i,o,u}=subset
        • B=a,b,c}
    • complement of set
      • if A sub set of "U"universal set than the complement is which is belongs to universal set not belongs to A
        • U={1,2,3,4,5,6,7,8,9}
        • A={1,2,3,4,5}
          • A'={6,7,8,9}(A's complement)

    Monday, April 14, 2014

    SET


    • SET
      • set is a well defined collection or grouping of objects
        • elements or members
          • object in a set are called elements or members of the set
          • set are usually denoted by capital letters of the English alpha..(A,B,X,Z)
          • members usually denoted by simple letters(a,b,x,z)
        • Example
          • if capital A is a set of odd integer below 10 than we can show this set as          A={1,3,5,7,9}
          • 3 is a element of A=    3 belongs to A          =3A
          • 8 is not element of A= 3 not belongs to A    =8∉A
        • no.of elements of the set
          • A={1,2,3,4,5,7}
          • no elements is a set A its denoted by n[A] 
            • n[A]=6
        • Set builder form
          • consider set"R" which is shown as R={x|x is a vowel letters below English alphabets}
          • X={a,e,i,o,u}

    programe devalopment life cycle


    1. define the problem
    2. design the solution
    3. code the program
    4. test the program
    5. implement the program

    • define the problem
      • 2+3=?

    • design the solution                                   
















    • code the programe
      • #include <iostream.h>
      • #include<conio.h>
      • void main()
      • {
      • int x,y,sum;
      • cout<<"input numbers";
      • cin>>x>>y;
      • sum=x+y
      • cout<<sum;
      • getch();
      • }
    • test the program                -success
    • document the program       -success
    • implement the program      -success

    about program


    • what is program?
      • program is a set of instructions or commands to instruct the computer to do specified task.
    • what is programming?
      • its written to solve the particulate problem and its written by using programming language.
        • OR
      • Programming is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs. This code can be written in a variety of computer programming languages. Some of these languages include Java, C, and Python. Computer code is a collection of typed words that the computer can clearly understand.