Wednesday, 10 May 2017

Program to display ASCII value of any character.

Program

#include<studio.h>
#include<condo.h>
void main( )
{
char ch;
clrscr();
printf("\n enter any character");
scanf("%C",&ch);
printf("%C",ch);
printf("\n ASCII value of character is=%d",ch);

}

Sunday, 7 May 2017

Program to enter any number which is prime.

Program 

#include<studio.h>
#include<condo.h>
void main ( )
{int no,i=2;
printf("\n enter any number");
scanf("%d",&no);
while(i<no)
{
if(no%i==0)
{
printf("\n not a prime number");
break;
}
i++;
}
if(i==no)
printf ("\n prime no");
}

Wednesday, 3 May 2017

Concepts in C ++.

User defined data types 

Structures 
and 
Unions.

Standalone variables of primitive types are not sufficient enough to handle real world problems.
It is often required to group logically related data items together.

Unions are conceptually similar to structures as they allow us to group together dissimilar type elements inside a single unit.
However the size of union is equal to size of its largest number element.
Eg:
 union result
 {
   int marks;
  char grade;
  float percent;
};        


Concepts in C++.

Tokens:

As we know the smallest individual units in a program are called tokens.
C++has following tokens:

1.Keywords
2.Identifiers
3.Constants
4.Strings
5.Operators

A  C++ program is written using these tokens ,white spaces and the syntax of the language.Most of C++ tokens are basically similar to C tokens with the exception of some additions and minor modifications .


Data abstraction and encapsulation.

Data abstraction and encapsulation.

The wrapping up of data and functions into a single unit is called as encapsulation.
Data encapsulation is the most striking feature of class.
The data is not accessible to the outside world, and only those functions which are wrapped in a class can access it.
These functions provide an interface between object data and programmer.
This insulation of data from direct access by the program is called Data hiding or information hiding.


Abstraction 

refers to the act of representing essential features without including the background details or explanation .
Classes use the concepts of abstraction and are defined as list of abstract attribute such as size,weight and cost, the functions to operate on these attributes.
They encapsulate essential properties of objects that are to be created.
The attributes are some time called Data members because they hold information.
The functions that operates on these data are called member functions.

Program to display ASCII value of any character.

Program #include<studio.h> #include<condo.h> void main( ) { char ch; clrscr(); printf("\n enter any character...