Comments

Thursday, November 8, 2012

OOP Create Object for switch board

Posted by at 9:49 AM Read our previous post

Object 
Create an objct for switch board which take user input and how many board he want to enter and number of swiches,regulator, and buttons.

Source code:

#include <iostream>
using namespace std;

class board
{
private:
        int reg[20],swt,socket,num;
public:
    void operation(int n,int m,int o)
    {
    int reg[20],swt=m,socket=o;
    num=n;

    for(n;0<=n;n--)
    {
        cout<<"Enter speed of fan"<<n<<"from 1 to 8:"<<endl;
        cin>>reg[n];}

        for(int n=0;n<num;n++)
        {cout<<"fan no :"<<n+1<<"at speed of :"<<reg[n+1]<<endl;}

        cout<<"Number of Button in board are :"<<swt<<endl;
        cout<<"Number of Plug in board are :"<<socket<<endl;
    }

   
   
   
};
void main()
{
    board brd[10];
    char press;
    do
    {
    int reg,button,plug,n=0;
    cout<<"Enter Regulator no"<<endl;
    cin>>reg;
    cout<<"Enter Button no"<<endl;
    cin>>button;
    cout<<"Enter Plug no"<<endl;
    cin>>plug;
    brd[n].operation(reg,button,plug);
    cout<<"enter y for continue"<<endl;
    cin>>press;
    n++;}while(press=='y');
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Popular Posts

Labels

© Codepirate is powered by Blogger - Template designed by Stramaxon - Best SEO Template