Saturday 11 January 2014

About C Plus Online Blog

                                                              
Cplusonline.blogspot.com  is a collection of various type of Programmings tutorials i.e. Object Oriented Programmings,notes of different Programming languages .This blog is  basically written for the programming learners as well as the students who require the knowledge of C++ or other Programming Languages.
All the learners can easily understand the Programming Concepts and the programmings language also. They can also Learns Like C,Java,Web Designing and Web development also for the job Puspose or for the Subject in the Syllabus In Schools or colleges.

Railway-Reservation MINI PROJECT in C

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream.h>
#include<time.h>
#include<iomanip.h>
#include<fstream.h>

PROGRAMS : (C & C++ Programming)


1.         Find the roots of a quadratic equation.

2.         Find whether given number is prime or not.

3.         Find the reverse of a given number.
            (Ex : 12345 becomes 54321).

4.         Find whether given number is palindrome or not.
            (Ex : 34543)

Data Structure Using C/C++ Language examples list


  1. Write a program to calculate the area and circumference of a circle using the relation.    ( Area = πr2  ) and circumference = 2πr.
  2. Write a program to find the grade obtained by the students of a class.
  3. Write a program to find the largest and the smallest from the given three integers.
  4. Write a program to find sum, difference, product and quotient of any two integers as per the choice of the user.
  5. Write a program to print a chart showing the temperature in centigrade from 0° to 100° to with their corresponding values in Farenhiet, using while loop and using the relation  C / 5 = F-32 / 9

JAVA OR INTERNET PROGRAMMING LIST( JAVA)


  1. Converting Temperature in Fahrenheit into Temperature in Celsius.
  2. Program for student Mark-List preparation
  3. Program for reverse and finding sum of individual digits of a given number
  4. Program to generate Fibonacci series
  5. Program for finding Factorial of a given number
  6. Program for find whether a given number is prime or not.
  7. Program for sorting the given numbers in Ascending and Descending order.
  8. Program for Matrix Multiplication

SOFTWARE ENGINEERING PRACTICAL QUESTIONS LISTS

1.Describe as many source of information as you can think of that should be consulted in order to perform a domain analysis for each of the following systems.
a.       Airline Reservation System
b.      The investments System
  1. You are developing a system for managing the processes of a small town public library. List all the actors for this system.
  2. An organization has three categories of employees : Professional staff, technical staff and support staff. The organization also has departments and divisions. Each employee belongs to either a departments or a divisions. Draw a class diagram corresponding to this. Assume that there will be different attributes or operations in all the classes, and that people will never need to change from one category to another.

VISUAL BASIC & WINDOWS PROGRAMMING LIST

VISUAL BASIC PROGRAMMING
  1. To write a Visual Basic application for calculator that will perform simple as well as complex calculations.
  2. To write a Visual Basic application for inserting and deleting strings from the list box.
  3. To develop a visual basic application for displaying the contents of the selected file using the file list box , directory list box and drive list box.
  4. To write a Visual Basic application to make a label to scroll from left to right and vice versa and change the mouse icon at each of the 8 * 8 cells.
  5. To create a menu editor with cut, copy and paste operations and search the word in the text.
  6. To create a Visual Basic application for a basic designer for drawing Line, Circle, Rectangle, Ellipse and Triangle.

A C++ program to perform linear search.

#include<iostream.h>
#include<conio.h>
Void main()
{
            Int a[100],n,ser;
Clrscr();
            Cout<<’\n Enter The Size of the value:”;
            Cin>>n;

A C++ program to find whether given triangle is isosceles or not.


#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int a,b,c,angle;
cout<<"\n Enter the three sides=";
cin>>a>>b>>c;

calculates grade of every student.

A C++ program which calculates grade of every student.

Range
Grade
>90
O
90<to>80
C
80<to>70
B
70<to>60
A
<60
E


#include<iostream.h>
#include<conio.h>
Void main()
{
           

A C++ program to calculate area & perimeter of rectangle by getting length & breath as input using classes.

Explanation 
If a rectangle has length l and width b
it has area A = lb
perimeter P = 2l + 2b = 2(l + b) 
program :

#include<iostream.h>

#include<conio.h>
Class rect
{
Int l,b;
Int area;
Int peri;

A C++ program to add two complex nos to produce resultant using classes.

#include<iostream.h>
#include<conio.h>
Class complex
{
            Float real1, ima1,real2,ima2;
            Float res_real, res_ima;
Public:

A C++ program to design a calculator using class.

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

class calc
{
            double newEntry;
            double displayedVal;
public:

Calculate area & Perimeter of circle using all kinds of constructor & destructor.

Explanation
The area enclosed by a circle is π multiplied by the radius squared
Area = π*r*r  
Perimeter of circle
C= 2πr

#include<iostream.h>
#include<conio.h>
Class circle
{
          Float r;
          Float area,peri;
Public:
          Circle()
          {
                   r=10;
          }
          Circle(int a)
          {
                   r=a;
          }
          Void calc()
          {
                   Area=3.14*r*r;
                   Peri=2*3.14*r;
          }
Void display()
          {
                   Cout<<”\n area of cricle :”<<area;
                   Cout<<”\n Perimeter of circle :”<<peri;
          }
          ~circle()
          {
                   Delete r;
                   Delete area;
                   Delete peri;
          }
};
Void main()
{
            Circle c;
            Cout<<’\n Constructors Without Parameters ;”;
c.calc();
            c.display();
            Circle c2(6.5);
            Cout<<”\n Constructors with parameters :”;
            C2.calc();
            C2.display();
}

C++ Programm using oops concepts

A program to creat a base Class shape. Use this Class to store two double type values that could be used to compute the area of figures. Derive two specific classes triangle and rectangle from the base class shape.Add to the base class a member function get_data() to initialize base class data members and another function display_area() to compute and display the area of figures.Make the display_area function a virtual function and redefine this function in the derived classes to suit their requirements.
Using these three classes design a program that will accept dimensions of a triangle or a rectangle interactively and display the area.


#include<iostream.h>
#include<conio.h>
class shape{

Advance Time Program in C++

Create a Class time that has separate int member data for hours,minutes and seconds.One constructor should initialize this data to 0 and another should initial;ize it to fixed values. Another member function should display it in 11:59:59 format. The final member function should add two time objects passed as arguments.

#include<iostream.h>
#include<conio.h>
class time
{private:int h;
             int m;
             int s;
 public:time()
            {h=0;m=0;s=0;}
            time(int a,int b,int c)
            {h=a;m=b;s=c;}
            void getdata();
            void showdata()
            {cout<<"\n the time -> "<<h<<":"<<m<<":"<<s<<".";
             cout<<"\n";
             getch();
            }
            void sum(time a,time b)
            {int t=0;
             h=a.h+b.h;
             m=a.m+b.m;
             s=a.s+b.s;
             if(s>60)
             {t=s/60;
              s=s-(60*t);
              m=m+t;
             }
             t=0;
             if(m>60)
             {t=m/60;
              m=m-(60*t);
              h=h+t;
             }
            }
}t1,t2,t3;
void time :: getdata()
{int c=0,t=0;
 clrscr();
 while(c==0)
 {cout<<"\n enter the parameters of time \n";
  cout<<"\n enter seconds: ";
  cin>>s;
  if(s<0)
  {cout<<"\n please enter the positive value \n";
  }
  else
  {if(s>60)
   {t=s/60;
    s=s-(t*60);
   }
   c=1;
  }
 }
 c=1;
 while(c==1)
 {cout<<"\n enter minutes: ";
  cin>>m;
  if(m<0)
  {cout<<"\n you have entered wrong value enter again";
  }
  else
  {m=m+t;
   if(m>60)
   {t=m/60;
     m=m-(t*60);
   }
   else
   {t=0;}
   c=0;
  }
 }
 c=0;
 while(c==0)
 {cout<<"\n enter hour: ";
  cin>>h;
  if(h<0)
  {cout<<"\n sorry you have entered wrong value enter again";
  }
  else
  {h=h+t;
   c=1;
  }
 }
}
void main()
{int n,i;
 clrscr();
 t1.getdata();
 t1.showdata();
 t2.getdata();
 t2.showdata();
 cout<<" sum of";
 t3.sum(t1,t2);
 t3.showdata();
 getch();
} 

A program in C++ to create a Class Octal to perform decimal to octal conversion and addition of an octal and an interger by overloading ‘+’ and ‘=’.

#include<iostream.h>
#include<conio.h>
class octal
{private:int ov;
 public:octal()
            {ov=0;}
            void getdata();
            void octcon(int);
            octal operator=(int a);
            int operator+(int a);
            void showdata(int iv,int x)
            {cout<<"\n the decimal number:";
             cout<<iv;
             cout<<"\n the sum:"<<ov;
             getch();
            }
            void showdata(int iv)
            {cout<<"\n the octal number:";
             cout<<ov;
             cout<<"\n the decimal number:";
             cout<<iv;
             getch();
            }
}n1,n2;
void octal :: getdata()
{int x=0,i=0,temp,c=0;
 cout<<"\n for addition \n";
 while(x!=1)
 {temp=0;i=0;c=0;
  cout<<"\n enter octal number to be added:";
  cin>>ov;
  temp=ov;
  while(i==0)
  {if((temp%10)>7)
   {c++;}
   temp=temp/10;
   if(temp==0)
   {i=1;}
  }
  if(c!=0)
  {cout<<"\n invalid value enter again \n";
  }
  if(c==0)
  {x=1;}
 }
}
int octal :: operator+(int v)
{int c=0,l,k=1,temp;
 temp=ov;
 while(temp!=0)
 {l=temp%10;
  l=l*k;
  c=c+l;
  temp=temp/10;
  k=k*8;
 }
 temp=c+v;
 return temp;
}
octal octal:: operator=(int iv)
{int r=0,i=0,j,l,k,temp;
 temp=iv;
 while(temp!=0)
 {k=1;
  for(j=0;j<i;j++)
  {k=k*10;}
  l=temp%8;
  temp=temp/8;
  r=k*l+r;
  i++;
 }
 ov=r;
}
void octal :: octcon(int iv)
{int r=0,i=0,j,l,k,temp;
 temp=iv;
 while(temp!=0)
 {k=1;
  for(j=0;j<i;j++)
  {k=k*10;}
  l=temp%8;
  temp=temp/8;
  r=k*l+r;
  i++;
 }
 ov=r;
}
void main()
{int c=0,k=0,v;
 clrscr();
 while(k==0)
 {clrscr();
  cout<<"\n enter the choice of operation to be performed \n1-conversion of decimal to octal \n2-addition of an octal and an integer \n3-exit\n \n enter choice:";
  cin>>c;
  switch(c)
  {case 1:cout<<"\n enter the integer value to be converted:";
              cin>>v;
              n1.octcon(v);
              n1.showdata(v);
              break;
   case 2:n1.getdata();
              cout<<"\n enter the integer value to be added:";
              cin>>v;
              n2=n1+v;
              n2.showdata(v,0);
              break;
   case 3:k=1;
              cout<<"\n thanks for using the program";
              break;
   default:cout<<"\n you have entered wrong choice try again";
               getch();
  }
 }
 getch();

}

program in C++ to create a linked list

A program in C++ to create a  linked list  with insert_front and delete_front as member functions by creating to objects. Use constructor to initialize the objects.

#include<iostream.h>
#include<conio.h>
struct node
{int info;
 struct node *next;
};
typedef struct node node;
class Linklist
{

A program in C++ using classes to enter the data of an employee and display it.

#include<iostream.h>
#include<conio.h>
class Emp
{public:char name[10];
            int age;
            int salary;
public:void init();
       void display();
};
void main()
{clrscr();
 Emp obj;
 obj.init();
 obj.display();
 getch();
}
void Emp::init()
{Emp obj;
 cout<<"\n ENTER THE NAME ==> \n";
 cin>>obj.name;
 cout<<"\n ENTER THE AGE ==> \n";
 cin>>obj.age;
 cout<<"\n ENTER THE SALARY ==> \n";
 cin>>obj.salary;
}
void Emp::display()
{Emp obj;
 cout<<"\n EMPLOYEE'S NAME \n"<<obj.name;
 cout<<"\n EMPLOYEE'S AGE \n"<<obj.age;
 cout<<"\n EMPLOYEE'S SALARY \n"<<obj.salary;
}


A program in C++ to create a Class Date and add and subtract two valid dates. Illustrate the use of copy constructor.

#include<iostream.h>
#include<conio.h>
class date
{private:int d;
             int m;
             int y;
 public:date()
            {d=0;m=0;y=0;}
            date(int a,int b,int c)
            {d=a;m=b;y=c;}
             void getdata();
             void showdata()
             {
             

Program Of Complex number

A program in C++ to create Class called complex and implement addition and subtraction of complex numbers by overloading the functions add and subtract which returns the complex number. Also overload the operator “<<” to display a complex number.

Small Project Of Banking System in C++

Assume that a bank maintains two kinds of accounts for its customers, one called as savings account and other as current account. The savings account provides compound interest and withdrawal facilities but no checkbook facility. The current account provides checkbook facility but no interest. Current account holders should maintain a minimum balance  and if the balance falls below this level as service charge is imposed.
Create a Class account that stress customer name, account number and type of account. From this derive Classes cur_account and sav_account to make them more specific to their requirements include necessary member functions in order to achieve the following tasks:
1) Accept deposits from a customer and update the balance.
2) Display the balance.
3) Compute and deposit the interest.
4) Permit withdrawal and update the balance.
5)Check for the minimum balance and impose penalty necessary and update the balance.

#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<string.h>
class Account
{private:char c_name[25];
             int acc_no;
             char type[7];
 public:void read(int);
            void display();
};
class Sav_acc:public Account
{private:float balance;
             float debit;
             float deposit;
             float interest;
 public:void update();
};
class Cur_acc:public Account
{private:float balance;
             int pages_ch;
             float debit;
             float deposit;
 public:void update_cur();
};
void Account::read(int x)
{int i=0,j=0;
 char sav[7]="savings",cur[7]="current";
 clrscr();
 cout<<"\nEnter your account number:";
 cin>>acc_no;
 cout<<"\nEnter your name:";
 cin>>c_name;
 if(x==1)
 {for(i=0;i<7;i++)
  {type[i]=sav[i];
  }
 }
 else
 {for(j=0;j<7;j++)
  {type[j]=cur[j];
  }
 }
}
void Sav_acc::update()
{int amt;
 cout<<"\n enter the balance:";
 cin>>balance;
 cout<<"\n Enter the amount of money to be withdrawn:";
 cin>>debit;
 cout<<"\n The balance after the withdrawal is:";
 balance=balance-debit;
 cout<<balance;
 cout<<"\n Enter the amount to be deposited:";
 cin>>deposit;
 cout<<"\n The amount after deposit is:";
 balance=balance+deposit;
 cout<<balance;
 cout<<"\n The compound interest for the two years is  3.5% \n";
 amt=(1+(3.5/100));
 interest=pow(amt,2);
 cout<<"\n The balance after the compound interest is:";
 balance=balance+interest;
 cout<<balance;
}
void Cur_acc::update_cur()
{int c=0;
 char ch;
 balance=0;
 cout<<"\n Enter the amount to be deposited:";
 cin>>deposit;
 cout<<"\n The amount after deposit is:";
 balance=balance+deposit;
 cout<<balance;
 cout<<"\n Enter the amount of money to be withdrawn:";
 cin>>debit;
 cout<<"\n The balance after the withdrawal is:";
 balance=balance-debit;
 cout<<balance;
 if(balance<1000)
 {cout<<"\n The balance in the account is less than the limit";
  balance=balance-100;
  cout<<"\n The balance after the penalty is:"<<balance;
 }
 while(c==0)
 {cout<<"\n do you want to issue the cheque book (y-yes,n-no): " ;
  cin>>ch;
  if(ch=='y')
  {cout<<"\n Enter the number of pages to be issued of the cheque book:";
   cin>>pages_ch;
   cout<<"\n the book will be issued to you after two days:";
   c=1;
  }
  else
  {if(ch=='n')
   {c=1;}
   else
   {cout<<"\n sorry you have entered wrong choice:";
    getch();
   }
  }
 }
}
void Account::display()
{cout<<"\nThe account number is:"<<acc_no;
 cout<<"\nThe name of the customer is:"<<c_name;
 cout<<"\nThe type of account is:"<<type;
 getch();
}
void main()
{int i=0,c=0;
 clrscr();
 while(i==0)
 {clrscr();
  cout<<"\n enter the choice of operation to be performed \n  1:savings \n  2:current \n  3:exit \n  enter choice:";
  cin>>c;
  switch(c)
  {case 1:Sav_acc a;
              a.read(c);
              a.update();
              a.display();
              getch();
              break;
   case 2:Cur_acc b;
              b.read(c);
              b.update_cur();
              b.display();
              getch();
              break;
   case 3:i=1;
              cout<<"\n thanks for using our services:";
              getch();
              break;
   default:cout<<"\n sorry you have entered wrong choice enter again:";
               getch();
  }
 }

}

Friday 10 January 2014

A program in C++ using classes to find out whether the entered number is automorphic or not.

#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{int n,r=0,i,s=0,m,a,b,l,k=0;
cout<<"enter a number";
clrscr();
cin>>n;
l=n;
 while(l!=0)
 {r=l%10;
 s=s+1;
 l=l/10;
 }
 b=n*n;
 m=pow(10,s);
 k=b/m;
 a=b-m*k;
 if (a==n)
  {cout<<"automorphic number"<<n;}
 else
  {cout<<"not automorphic";}
  getch();
}




1-A program in C++ using classes to calculate the area of a circle , a rectangle and a triangle on user’s choice.

#include<iostream.h>
#include<conio.h>
class ar
{private:float a;
 public:ar()
            {a=0;}
            ~ar()
            {a=0;}
            void area(float x)
            {a=3.4142*x*x;
            }
            void area(float x,float y)
            {a=x*y;
            }
            void area(float x,float y,int u)
            {a=(x*y)/2;
            }
            void showarea()
            {cout<<"\n the area of the figure is:"<<a;
            }
}n1;
void main()
{int n=0,i;
 float h,b,r;
 clrscr();
 while(n!=1)
 {clrscr();
  cout<<"\n enter the choice of figure whose area is to be calculated \n1-circle\n2-rectangle\n3-triangle\nenter your choice:";
  cin>>i;
  switch(i)
  {case 1:cout<<"\nfor circle\n";
              cout<<"\n enter the radius of the circle:";
              cin>>r;
              n1.area(r);
              n1.showarea();
              break;
   case 2:cout<<"\nfor rectangle\n";
              cout<<"\n enter the  length of the rectangle:";
              cin>>h;
              cout<<"\n enter the width of the rectangel:";
              cin>>b;
              n1.area(h,b);
              n1.showarea();
              break;
   case 3:cout<<"\nfor triangle\n";
              cout<<"\n enter the  height of the triangle:";
              cin>>h;
              cout<<"\n enter the base length of the triangel:";
              cin>>b;
              n1.area(h,b,1);
              n1.showarea();
              break;
   default:cout<<"\n sorry you have entered wrong choice\n";
  }
  cout<<"\n do you want to continue (yes:0,no:1):";
  cin>>n;
 }
 getch();
}