Sunday 25 March 2018

What is Programming Language ?

A Programming language is nothing but a vocabulary and set of grammatical rules for instructing a computer to perform specific tasks. The term Programming language usually refers to high-level language, such as BASIC, C, C++.

High-level programming language are more complex than the languages the computer actually understands,called machine language.

Lying between machine language and high-level language are languages called assembly language. Assembly language allow a programmer to substitute names instead of numbers as in machine languages.

Lying above high-level language are languages called fourth-generation languages (usually abbreviated 4GL), represents the class of computer language closest to human languages.

Structure of C++ Program

A C++ program consist four sections as shown in following fig.This section may be placed in a separate code files and then compiled independently or jointly.


Section I : Header File Declaration Section
  1. Header Files used in the program are listed here.
  2. Header files provides prototype declarations for different library functions.
  3. Basically all preprocessor directives are written in this section.

Section II : Global Declaration Section
  1. Global Variables are declared here.
  2. Global Declaration include
       Declaring structure
       Declaring class
       Declaring variable.

Section III : Class Declaration Section 
   1. Actually this section can be considered as a sub section for the global declaration section.
   2. Class declaration and all method of that class are defined here.

Section IV : main Function
  1. Each and every cpp program always starts with main function.
  2. This is the entry point for the functions.Each and every method is called indirectly through main.
  3.We can create class object in the main.
  4. Operating system call this function automatically.

This approach is based on client server model as shown in figure.
  This class definition including member function constitute the server that provides the service to the main program known as a client.
  Client uses the server through public interface class.

Simple C++ Program
//Program to print String
#include<conio.h>
#include<iostream.h>
class first
{
  public:
  void display()
  {
   cout<<"Welcome to the world of C++";
   }
};
 void main()
 {
  first f;
  f.display();
  getch();
}

Output-
    Welcome to the world of C++

Derived Data Types

Derived data type is a data type which is derived from primitive data type.
Ex: Array is a collection of homogeneous types of element and it stores elements at adjacent memory locations called as contiguous memory locations.
Syntax:
Data type name_of_array[size];

Ex:
int arr[10];
This array stores ten integer types of element at adjacent memory locations.
arr[0]  arr[1]  arr[2]  arr[3]  arr[4]  arr[5]  arr[6]  arr[7]  arr[9].

\* Write a program to implement array */
#include<conio.h>
#include<stdio.h>
void main()
{
int a[5]={10,20,30,40,50};
int i;
clrscr();
printf("\n\n\tElements in forward direction is -->\n\n");
for(i=0;i<5;i++)
{
printf("\t%d",a[i]);

}
printf("\n\n\tElements in Backward Direction is-->\n\n");
for(i=4;i>=0;i--)
{
printf("\t%d",a[i]);
}
getch();
}

Output-
     Elements in forward direction is -->
      10   20   30   40   50
     Elements in Backward Direction is-->
      50   40   30   20   10

User Defined data types

Structure 
  Structure is a collection of variables of different data types grouped together under a single name.
         Each variable within a structure is called as member of structure.

Syntax of defining structure :-
     struct structure_name
      {
        Structure_member 1;
        Structure_member 2;
        ...............................
       ................................
       Structure_member n;
        }instances;

           OR

   struct structure_name
   {
      Structure_member 1;
      Structure_member 2;
        ...............................
       ................................
       Structure_member n;
        };
          struct structure_name instance;

Ex-
 struct student
  {
    char name[20];
    int rollno;
    float per;
   }stud1,stude2;
                   OR
  
 struct student
  {
    char name[20];
    int rollno;
    float per;
   } 
 struct student stud1,stud2;

Initialization of structure Variable:
   
An instance of a structure can be assigned values during declaration as follows.
        struct student
        {
          char name[20];
          int rollno;
         float per;
        }stud1={"irawen",101,78.12};

Accessing Structure Member:
   Individual members of structure can be used like other variables. Structure member can be assessed by dot operator(.).
 This dot operator (.) is used between the structure name and member name.
   Ex- stud1.name , stud1.rollno , stud1.per
values can also be assigned to structure member.
     stud1.name="irawen";
     stud1.rollno=101;
     stud1.per=78.12;

Question 1) Write a program to define structure 'Tender' having data member tender_no,cost and company_name.Accept and display data for one variable of the structure.

#include<conio.h>
#include<iostream.h>
struct Tender
{
  int tender_no;
  float cost;
  char company_name[20];
};
void main()
{
Tender t1;
clrscr();
cout<<"\tEnter Tender Number";
cin>>t1.tender_no;
cout<<"\nEnter Cost of Tender";
cin>>t1.cost;
cout<<"\nEnter Company Name";
cin>>t1.company_name;
cout<<"\n\n\tTender Number is →"<<t1.tender_no;
cout<<"\n\n\tTender cost is→"<<t1.cost;
cout<<"\n\n\tCompany Name is→"<<t1.company_name;
getch();
}

Output-
  Enter Tender Number101
  Enter Cost of Tender1234
  Enter Company NameIrawen.info
                          Tender Number is→101
                          Tender cost is→1234
                          Tender Name is→Irawen.info 

Union :
    Union are a concept borrowed from structures and therefore the same syntax as structure.
          But here is a major difference between them is in storage structures. In structure there is a separate storage memory location for each data member where all the member of union share the memory locations.
Ex-
  Union item
   {
     int a;
     float b;
     char c;
   } it;

Example Union-
#include<conio.h>
#include<stdio.h>
void main()
{
union item
 {
   int m;
   float p;
   char ch;
  }it;
clrscr();
it.m=12;
it.p=23.12;
it.ch='A';
printf("\n\n\tItem No is→%d",it.m);
printf("\n\n\tPrice is→%f",it.p);
printf("\n\n\tStarting character of item is→%c",it.ch);
getch();
}

Output-
    Item No is→2751
    Price is→23.119753
    Starting character of item is→A

Enumerated Data Types:-
   An enumerated data type is another user defined type which provides a way of attaching names to the members.
The enum keyword automatically enumerates the list of words by assigning values 0,1,2.....and so on.
    Syntax:   
          enum shape{circle.square,triangle};
          enum color{red,blue,green,yellow};
         :Declaring Variable of enum:
        Ex.shape ellipse;color background;
By default enum assigns integer values starting with '0' zero for the first enumerator,1 for the second and so on..
 We can over ride the default by just assigning integer values to enumerator.
  enum color{red,blue=4,green=3};
  enum color{red=5,blue,green};

#include<iostream.h>
#include<conio.h>
void main();
{
 enum color{red,blue,green};
 enum color1{red1,blue1=4,green1=6};
 cout<<"\n\n\tColor of Background-->"<<red;
 cout<<"\n\n\tColor of Background-->"<<blue;
  cout<<"\n\n\tColor of Background-->"<<green;
  cout<<"\n\n\tColor of Background-->"<<red1;
  cout<<"\n\n\tColor of Background-->"<<blue1;
  cout<<"\n\n\tColor of Background-->"<<green1;
  getch();
}

Output-
      Color of Background-->0
      Color of Background-->1
      Color of Background-->2
      Color of Background-->0
      Color of Background-->4
      Color of Background-->6

Saturday 24 March 2018

What is C languages ?

C is a very powerful and widely used language. It is used in many scientific programming situations. It forms (or is the basis for) the core of the modern languages Java and C++. It allows you access to the bare bones of your computer.


High Level Language:-
  BASIC :
      Beginner's all-purpose symbolic instruction code
      Used only for small general purpose application
  COBOL :
       Common Business Oriented Language
       Used for business applications only
  FORTRAN :
       Formula Translation
       Used only for engineering applications
  PASCAL :
       These specific language for specific software
       If we want to go to America we must know English Language


Low Level Language:-
  It is a machine level language
  Understandable for computer in 0 1 0 1 0 1 form
  In earlier days this language is used for giving commands computer in 0101010100101010101 format.




Middle Level Language :-
  Middle-level language (MLL) is a computer programming language that interacts with the abstraction layer of a computer system.
  It has both features of HLL and LLL
  It translates the human readable language into Machine language and vice versa
  It not only used to write application software but also system software and communication with hardware.


Basic Knowledge about Software

What is Computer ?
  → Computer is an electronic device that takes input, process it and gives output.

What is 0 and 1 ?
  → There is nothing like 0 and 1 in computer.There is no physical significance of 0 and 1
  → Any information can be encoded as a sequence of 0 and 1.

How 0 and 1 get stored in memory ?
What is Hardware ?
 → Hardware is a comprehensive term for all of the physical parts of a computer, as distinguished from the data it contains or operates on, and the software that provides instruction for the hardware to accomplish tasks
    Hardware is anything which is tangible.

What is a File ?
   File is a data bundle.


What is software ?
  Application Software
  System Software

Program and Process
    Set of instruction is called Program
    Active state of a program is called Process

Operating System
   It is a system software
   Examples are DOS, windows xp, windows vista, windows 7 windows 8, Solaris, Macintosh, Linux, ubuntu etc.
It provides interface between user and machine.
Acts as a manger of the computer system
It does process management, memory management, file management.

Execution of Program


Software develop in C language


Why C language is Important ?

Why C language is so important ?
  • Worth to know about C language
              - Oracle is written in C
              - Core libraries of android are written in C
              - MySQL is written in C
              - Almost every device driver is written in C
              - Major part of web browser is written in C
              - Unix operating system is developed in C
              - C is the world's most popular programming language
   
  • For Students  
              - C is important to build programming skills
              - C covers basic features of all programming language 
              - C campus recruitment process
              - C is most popular language for hardware dependent programming
             
  • History of C language
            It is Developer of BCPL
            Basic Combined Programming Language
            It is develop in 1966


Developer of B language
It is develop in 1969.Also developer of UNIX operating system 
He is also developed first master level chess called Belle in 1980.

Developer of C language in 1972.
At AT & T's Bell LABs, USA
Co-developer of UNIX operating system


Recursion

Recursive function is a function that calls itself. When a function calls another function and that second function calls the third function then this kind of a function is called nesting of functions.But a recursive is the function that calls itself repeatedly.

A simple example :
main ( )
{
printf (" this is an example of recursive function");
main( );
}
 when this program is executed.The line is printed repeatedly and indefinitely.We might have to abruptly terminate the execution.

/*Program to calculate Factorial of a number */
#include <stdio.h>
void calc_factorial (int);  //function prototype
void calc_factorial (int i)
{
int I, factorial_number = 1;
for (i = 1; I < = n; ++i)
   factorial_number *=I;
printf("The factorial of %d is %d\n", n, factorial_number);
}
int main(void)
{
int number = 0;
printf(" Enter a number\n");
scanf("%d",&number);
calc_factorial (number);
return 0;
}

Sample Program Output
  Enter a number
     3
   The factorial of 3 is 6

Friday 23 March 2018

Function

A function is a self contained block of statement that perform a coherent task of some kind.
Function provides modularity to the software.

Function definition :
[data type] function name (argument list)
argument declaration;
{
local variable declaration;
statements;
[return expression]
}

Example :
mul(a,b)
int a,b;
{
int y;
y = a + b;
return y;
}
When the value of y which is the addition of the values of a and b.The last two statement i.e.,
y = a + b; can be combined as
return (y)
return (a + b)

Why Functions are used ?
  1. Many program require that a specific function is repeated many times instead of writing the function code as many timers as it is required we can write it as a single function and access the same function again as many times as it is required.
  2. We can avoid writing redundant program code  of some instructions again and again.
  3. Programs with using functions are compact and easy to understand.
  4.Testing and correcting errors is easy because errors are localized and corrected.
  5.We can understand the flow of program and its code easily since the readability in enhanced while using the functions.
  6. A single function written in a program can also be used in other programs also.

#include <stdio.h>
/* function body */
int add (int x, int y){
 int z;
z = x + y;
return (z);
}
main ( )
{
int i,j,k;
i = 10;
j = 20;
k = add(i,j);  /* function call */
printf ("The value of k is %d\n",k);
}
The value of k is 30

Scope Resolution Operator

Scope of the variable is the life time of the variable in the program.
A variable can either global or local scope.

Global Variable is a declared in the main body of the source code outside all functions while the local variable is the one declared within the body of function or block.

In 'C' the global version version of the variable of the variable can not be accessed from within the inner block.

In C++ , scope resolution operator (::) is used to access global variable.
Syntax:   ::global_variable_name;

#include<conio.h>
#include<iostream.h>
int a = 10;
void main( )
{
int a = 15;
clrscr( );
cout<<"\n\n\t Local a is -->"<<a<<"\tGlobal a is -->"<<::a;
a = 20;
cout<<"\n\n\t Local a is -->"<<a<<"\tGlobal a is -->"<<::a;
getch( );
}

OutPut:-
Local a is -->15     Global a is -->10
Local a is -->20     Global a is -->10

Output and Input Operator

cout <<"Welcome to the Computer Language";

This causes the string in quotation marks to be displayed on screen.

'cout' is a predefined object that represents standard output stream i.e. screen.

The operator '<<' is called as insertion or put to operator.It inserts the contents of the variable on its right to the object on its left.

Input Operator :

 cin >> no;
It is an input statement and causes the programs to wait for the user to type in a number.The number keyed in is placed in the variable 'no'.

'cin' is predefined object that represents standard input stream i.e. keyboard.

The operator '>>' is know as extraction or get from operator.
 
It extracts or takes the value from the keyboard and assigns it to the variable on its right.

Bitwise Operators

In order to manipulate the data at the bit level, the bitwise operators are provided in Java. These operators are used for testing the bits as well as shifting them to left or right etc.

These can be applied to integer types only.That is, they can not be used along with float or double value.


All these operator except one's complement operator are binary operators. These  perform the given bitwise operation on the operands.

Accordingly, the result is obtained.Shift operators shift the binary equivalent bits of the operand to respective left or right position.

Increment and Decrement Operators

Like C and C++ , Java is also having the increment and decrement operators' i.e. ++ and --. Both  of these are unary operators.The operator + + adds 1 to the operand and - - subtract 1 from the operand.

They can be written in following from:
 x++  or x--
 ++x  or --x

Both forms of the ++ increment the value of variable by one i.e. x++ or ++x will be equivalent to x = x+1. As well as , x - - is equivalent to x = x - 1.

When the increment or decrement operator is used before variable,it is called as pre-increment or post-increment operator.And when it is used after variable.it is called as post-increment or post-decrement operator.

The difference is simple.That is, when these pre-increment or pre-decrement operators are involved in the arithmetic expression .
For example,
 z = 14;
 y = z ++;

Here, the value of variable y will be 14 and z will be 15, because in the second expression, post increment operator is used. Value of variable z is assigned to y first and then it is incremented.If we change the second expression to,
y = ++z;

Now, both the values of y and z will be 15.Pre-increment operator does its job first the then uses the value in the expression.
 

Assignment Operators

Assignment operators are used to assign the value of an expression to the variable.The general assignment operator is '='. This is used to assign the value given to its right side to the variable written on left side.

Other assignment operators are also known as shorthand operators become they minimize our work of writing arithmetic expression.

Assignment operators are listed in table given below-

Logical Operators

There are only three logical operators which are related with the logical decision.These are listed in the following table-
First two operators are used to combine the conditions i.e. to form a compound conditional expression.Third operator is used to inverse the condition.
For example,
 x > y && k !=b12

This is termed as the logical expression.Whole expression also returns the Boolean value.That is, the above expression will return true when the both the conditions (x > y) and (k!=12) are true.If any one of these condition is false the expression will return false.

Consider another example,
m==99 || j <=10
This logical expression involves the logical OR operator.The expression will return true only when any one of the conditions (m==99 and j<=10) is true.If both condition are false, the whole expression will also expression will return false.

The third operator is know as logical NOT operator.This is the only unary logical operator and generally used to negate the condition.If we write this operator in front of any other relational or logical expression, the result of the expression will be inverted.That is, true will become false and false will become true.

For example,
x = 36 then
! (x > 40) will return true
! (x == 36) will return false
The following program will clear the idea of logical operators and expression.

Relational Operators

When we want to compare value of two variables for various means, relational operators are used. After comparing these values we may take several decision in the program.
Relational operators can be called as comparison operators. For example, we want to  find the largest of two integers, we can use '>' operators to perform comparison.
The expressions such as,
 val > 12 or cal < sal 
contains the relational operator. So, they can be termed as relational expression. The value of value relational expression can be either true or false. 
For example, if cal = 10 and sal = 15 then,
cal < sal is true 
while
sal > 20 is false

Java supports six different relational operators. These are listed and explained in the table below.

Observe the following relational expressions which returns boolean values 
          36 > 42 true
          52.14 < 45 false
          10 < 8 + 9 false
         -74 ! = 0 false

When the arithmetic expressions are used on either side of a relational operator, the arithmetic expression will be evaluated first and then the results are compared. In short, the arithmetic operators are having highest priority over relational operators.

Arithmetic Operators

These include all the operators which are used to perform basic arithmetic operations. These are listed.

Operator Meaning Example

According to number of operands required for an operator, they are classified as Unary (one operand), binary (two operands) and ternary (three operands) operators.
First five operators are binary operators as they required two operands. Last two operators are unary operators i.e they require only one operand to operate.
They are generally used to assign the sign for the constant.When all the operands in an arithmetic expression are integer then it is called as integer expression. They always return integer value.

For example : x = 10 and y = 3
  Then , x + y = 13
   x - y = 7
  x * y = 30
  x / y = 3 ( decimal part is truncated)
  x % y = 1 (remainder of the division)

When an arithmetic expression involves only real operands is called as real arithmetic.A real operand may assume values either in decimal or exponent notation.
When one of the operands is real and the other is integer, the operation is called as mixed-mode expression.If any one of the operands is floating point, then the operation will generate the floating point result.Thus,
  25 / 10.0 will generate result 2.5
  Whereas,
 25 / 10 will generate result 2

Operators

An operator is the symbol that takes one or more arguments and operates on them to produce a result.

The constants, variable or expression on which operator operates are called as operands. Java supports a rich set of operators which are used in a program, to manipulate the data and variables.

They are usually the part of  logical expression. Operators in Java are classified into number of categories:

   1. Arithmetic Operators
   2. Assignment Operators 
   3. Increment / Decrement Operators 
   4. Relational Operators
   5. Logical Operator
   6. Conditional Operators
   7. Special Operators

Thursday 22 March 2018

Pseudo Codes for Basic Logic (Control) Structure

Pseudocode is a compact and informal high-level description of a computer programming algorithm.
  Pseudo-code typically omits details that are not essential for human understanding of the algorithm such as variable declaration, system-specific code and subroutines.
   The purpose of using pseodocode is that it is easier for humans to understand than conventional programming language code.

Sequence Logic
   Sequence logic is used for performing instruction one after another in sequence. The logic flow of pseudo code is from top to bottom.

Selection Logic
  1. If-else
         Selection logic also known as decision logic is used for making decision.It is also called as decision logic.
       It is used for selecting the proper path out of two or more alternative paths in program logic.Selection logic is depicted as an IF.....THEN.....ELSE or on IF.....THEN or a case structure.
    The IF......THEN......ELSE construct says that if condition is true then 
            do process-I else (if condition is not true) do process-II.

  If we simply want do decide if a process is to be performed or not the IF.....THEN structure is used this structure says that if condition is true then do process-I and if it is not true then skip over process-I.

Switch-case
    The case structure is multiple way selection logic structure.The CASE structure indicates that if the value of type is equal to type I execute process-I if it equal to type II executes process II if it equals to type 3 execute process 3 if so on.
                       Fig: Flowchart for 'CASE' selection structure

Iteration (or Looping) Logic

    The looping structures in C are-
                 While loop
                 For loop
                 Do -while loop
                 Repeat-until
  Iteration logic is used to produce loops in program logic when one or more instruction may be executed several times depending on some condition.
    In case Do-WHILE the looping will continue as long as the condition is true the looping steps when the condition is not true.
    Important : Do-while loop is useful when we want the statements within the loop must be executed at least once.
                        Fig: Flowchart for DO-WHILE iteration structure

In case of REPEAT.....UNTIL : The looping continues until the condition becomes true. That is the execution of the statement  within the loop is repeated as long as the condition is not true.

Use of "Go to" Statement

The goto statement is the most basic form of unconditional transfer of control.
  Although the keyword may either be in upper or lower case depending on the language, it is usually
written as:
   goto label

 The effect of a goto statement is to cause the next statement to be executed to be the statement appearing at ( or immediately after ) the indicated label. A label is an explicit name or number assigned to a fixed position within the source code and which may be referenced by control flow statement appearing elsewhere in the source code.

     Goto statement have been considered harmful by many computer scientists, notably Dijkstra.

Importance of use of Indentation in Programming

Remember that indentation is useful for people, not the machine Correct use of identifiers, white space and documentation makes your program easier to understand for those humans reading it. Since you also will be reading your own program, you will want to be consistent and current with your documentation.

  Properties of good style
    1. Program that are easy to read and understand.
    2. Programs that communicate the algorithm used in a form easy to follow.
    3.Programs that are easy to modify and enhance to adapt to new and changing environments.( It is important to keep in mind that the programmer making the modifications may not be the initial author.)

Principles of good style
  1. Clarity and simplicity
         Avoid unnecessary complexity.When possible,use the straight forward method.Don't sacrifice clarity for cleverness.
  2. Use meaningful identifiers
         Choose names for constant, variables,functions,etc. , that accurately describe the purpose of the identifier.For instance, a, x, t are poor identifiers because they are meaningless whereas age, salary, and first_name are good choices.Constant should be all uppercase. Other identifiers should make use of the underscore"_" and uppercase letters to distinguish the words in an identifier (FirstName or first_name but not firstname).
   3. One statement per line
   4. Use proper indentation of control structures.
         Be consistent with indentation.There are several styles to choose from but whichever you choose, be consistent! Some example are given below.Note the placement of the curly braces and the code.

Variables

"A variables is a temporary container to store information , it is a named location in computer memory where varying data like numbers and characters can be stored and manipulated during the execution of the program".
A variable must be declared before it is used.It is a must because the compiler wants to be aware of it.

Types of Variables

Basically there are two types of variables , namely
 1. local Variable
 2. Global Variable

Local Variable 
  The local variable is created when the functions gets control and is destroyed when the control transfers back to the caller.

Global Variable
  Whereas the Global Variable is known and accessible throughout program.Global Variables are declared at the top of the module.

Declaration of Variable
  The declaration of a variable is simple in C++ language.It begins with the data type, followed by at least a space, followed by the name of a variable with a semicolon. Space is optional before the semicolon.

For Example

  int my_Age;
  int my_Salary;
  int_employee;

If different variable are using the same data type on the same line are also allowed,but care must be taken to separate two with a comma except the last one that would end with a semicolon.

Initialization of variables

   When the variables in the example above are declared, they have an undetermined value until they are assigned a value for the first time.But it is possible for a variable to have a specific value from the moment it is declared.This is called the initialization of the variable.
      type identifier = initial_value;
For example, to declare a variable of type int called x and initialize it to a value of zero from the same moment it is declared,we can write:
     int x = 0;

Comments in C++

Program comments are explanatory statement that you can include in the C++ code that you write and helps anyone reading it's source code. All programming languages allow for some form and comments.
C++ supports single-line comment (//) and multi-line comments (/*...............................*/). All characters available inside any comment are ignored by C++ compiler.
C++ comments start with /* and end with */.

For example :-
 /* This is a comment */
.* C++ comments can also
* span multiple lines
*/

A comment can also start with // , extending to the end of the line.For example:
#include <iostream.h>
main( )
{
cout << "Hello World";  // prints Hello World

return 0;
}
When the above code is compiled ,it will ignore  //prints Hello World and final executable will produce the following results;

Output:-
Hello World

Wednesday 21 March 2018

What is database?

A database is integrated collection of related information along with the details so that it is available to the several user for the different application.
                                        This is a database

Table/Entity
  Table is the structure inside database that contains data organized in columns and rows.




Column/Field/Feature/Attributes
  The name of each column in a table is used to interpret its meaning and is called an attributes.
 

Row/Records/Tuple
  Each row in a table represents a record and is called tuple.

Example:-
     Rahul , 101 , Delhi , rahul@gmail.com
     Sona , 102 , Kolkata , sona@gmail.com
     Sumit , 103 , sumit@gmail.com , Ranchi
     Sam , sam@gmail.com , Noida , 104
                This is a database list of four person, now its create in table form

Database Management System (DBMS)
  DBMS is the software system that allows the access to the data in the database.


Relational Database Management System (RDBMS)
 RDBMS avoided the navigation model as in old DBMS and introduced Relational model. The relational model has relationship between tables using primary keys, foreign keys and indexes. thus the fetching and storing  of data become faster than the old Navigation model.RDBMS is useful to efficiently manage  vast amount of data and is used in large business application.
  Ex:- SQL Server , Oracle , MySQL , MariaDB , SQLite.

Structural Query Language (SQL)
  It is commonly used with all relational database for data definition and manipulation.

Feature of SQL :-
  It is a non procedural language.
  It is an English-like language.
  It can process a single record as well as set of records at a time.
  All SQL statement define what is to be done rather than how it is to be done.
  SQL has facilities for defining database views , security , transaction etc. 

C++ Tokens

The smallest individual units in a program is known as Tokens.
The C++ programs are written by using these tokens , white spaces and syntax of the language.
C++ has following Tokens 
  1. Keywords
  2. Identifiers
  3. Constants
  4. Strings
  5. Operators

Keyword :-
  Keyword are those words meaning whose meaning is known to the compiler or whose meaning is already defined by compiler.
 Keywords are also called as reserved words.Keywords should not be used in variable declaration.
 Following are some example of keywords
   auto , break , case , char , class , const , continue , default,..........................................

Identifiers :-
  Identifiers refers to the name of the variables , functions , arrays , classes created by the programmer.
  Rules of Naming identifiers:-
   1. Only alphabets , digits , and underscore are permitted.
   2. Variable name should not start with digit.
   3. Uppercase and lowercase letter are distinct.
   4. Keywords should not be used as name of the identifier.
   5. 'C' recognizes 32 characters in name of the identifiers but C++ has no limit on its length.

Constant :-
  Each primitive data type has their own constant value declaration also called as literals.

Primary Constant
  a. Integer Constant
  b. Real Constant 
  c. Character Constant

Secondary Constant
  a. Array
  b. Pointer
  c. Structure and unions
  d. Enum

Primary Constant
 Integer Constant :-
   1. Integer constant must have at least one digit.
   2. They must not have a decimal point.
   3. They can be positive or negative.
   4. If there is no any sign to integer it is assume to be positive.
   5. No comma or blank spaces are allowed within the integer constant.
          e.g.  426, +756 , -588 etc.

Real Constant :-
   1. These are generally called as floating point constant.They can be written two forms.That is , fractional form & exponential form.
  2. Real constant can be positive or negative.
  3. They must have decimal point.
  4. Default sign is positive.
  5. No comma or blank spaces are allowed in the real number.
       e.g. 22.45 , -85.23 , -11.20 , +3.211e-4 , 5.6e4 etc.

Character Constant :-
   1. The character constant is a single alphabet or a single digit or s single special symbol enclosed within the single quotation marks.
   2. Maximum length of a character is one character.

Popular Posts

Categories

AI (27) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (117) C (77) C# (12) C++ (82) Course (62) Coursera (179) coursewra (1) Cybersecurity (22) data management (11) Data Science (95) Data Strucures (6) Deep Learning (9) Django (6) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (5) flutter (1) FPL (17) Google (19) Hadoop (3) HTML&CSS (46) IBM (25) IoT (1) IS (25) Java (92) Leet Code (4) Machine Learning (44) Meta (18) MICHIGAN (5) microsoft (3) Pandas (3) PHP (20) Projects (29) Python (748) Python Coding Challenge (221) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (2) Software (17) SQL (40) UX Research (1) web application (8)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses