Wednesday, 1 May 2013

Company Employe Include in a list That Have Sialry and name and residanse in c++ and OOP'S


#include<conio.h>
#include<iostream.h>
class college
{
char name[10];
char res[10];
public:
void indata()
{
cout<<"Enter the name";
cin>>name;
cout<<"Enter the residence";
cin>>res;
}
void display()
{
cout<<"The name is"<<name<<endl;
cout<<"The residence is"<<res<<endl;
}
};
class office:public college
{
int age;
int salary;
char des[10];
public:
void indata1()
{
cout<<"Enter the age"<<endl;
cin>>age;
cout<<"Enter salary"<<endl;
cin>>salary;
cout<<"Enter designation"<<endl;
cin>>des;
 }
void display1()
 {
cout<<"The age="<<age<<endl;
cout<<"The salary="<<salary<<endl;
cout<<"The designation is:" <<des<<endl;
}
} ;
class collegues:public office
{
char looks[10];
char comp[10];
public:
void indata2()
{
indata();
indata1();
cout<<"Enter the looks"<<endl;
cin>>looks;
cout<<"Enter the complexion"<<endl;
cin>>comp;
cout<<endl;
}
void display2()
{
display();
display1();
cout<<"Looks:" <<looks<<endl;
cout<<"Complexion:"<<comp<<endl;
}
} ;
void main()
{
clrscr();
collegues c;
c.indata2();
c.display2();
getch();
}

GraphDriver use At C++ OR OOP'S


#include<chandra.h>

// Global Variable Declaration..

int GraphDriver = DETECT; /* Request auto-detection */
int GraphMode;
void func_gen(float ,float ,float ,int, int, int);
void drawAxis();
void graph();
float mod(float );
void yx1(float );
void yx2(float );
float graphFunction(float );

//Main Function

void main()
{
initgraph( &GraphDriver, &GraphMode, "../bgi" );
    char c;
    int zoom_factor=10, xsh=0, ysh=0;
    float precision=0.01, min_range=-30, max_range=30;
    func_gen(precision,min_range,max_range,zoom_factor,xsh,ysh);
  do{
    c=getch();

    if(c=='w'||c=='W')
    {
      precision=precision/10;
      func_gen(precision,min_range,max_range,zoom_factor,xsh,ysh);
    }

    if(c=='q'||c=='Q')
    {
      precision=precision*10;
      func_gen(precision,min_range,max_range,zoom_factor,xsh,ysh);
    }

    if(c=='+')
    {
      zoom_factor +=2;
      func_gen(precision,min_range,max_range,zoom_factor,xsh,ysh);
    }

    if(c=='-')
    {
      zoom_factor -=2;
      func_gen(precision,min_range,max_range,zoom_factor,xsh,ysh);
    }

    if(c=='x' || c=='x')
    {
      ysh += 2;
      func_gen(precision,min_range,max_range,zoom_factor,xsh,ysh);
    }

     if(c=='s' || c=='S')
    {
      xsh += 2;
      func_gen(precision,min_range,max_range,zoom_factor,xsh,ysh);
    }

    if(c=='c' || c=='C')
    {
      ysh -= 2;
      func_gen(precision,min_range,max_range,zoom_factor,xsh,ysh);
    }

     if(c=='A' || c=='a')
    {
      xsh -= 2;
      func_gen(precision,min_range,max_range,zoom_factor,xsh,ysh);
    }

    if(c=='R' || c=='r')
    {
      ysh = 0;
      xsh = 0;
      precision = 0.1;
      zoom_factor=10;
      func_gen(precision,min_range,max_range,zoom_factor,xsh,ysh);
    }

    }
    while(c=='w'||c=='W'||c=='q'||c=='Q'||c=='+'||c=='-'||c=='s'||c=='S'||c=='x'||c=='X'||c=='a'||c=='A'||c=='c'||c=='C'||c=='r'||c=='R');

    closegraph();
}

//Mod Function

float mod(float x)
{
 if(x<0)
 return (-1)*x;

 else
 return x;

}

// COORDINATE AXIS

void yx1(float min_range, float max_range)
{

    float x=min_range;
    while(x<=max_range)
    { float y;

      y = x;


    float xcord=320+10*x;
    float ycord=240-10*y;
    if((xcord<=640 && xcord>=0) && (ycord>=0 && ycord<=480))
putpixel(xcord,ycord,50);
x += 0.1;
     }

}

void yx2(float min_range, float max_range)
{

    float x=min_range;
    while(x<=max_range)
    { float y;

      y = -1*x;


    float xcord=320+10*x;
    float ycord=240-10*y;
    if((xcord<=640 && xcord>=0) && (ycord>=0 && ycord<=480))
putpixel(xcord,ycord,50);
x += 0.1;
     }

}


void drawAxis()
{
      int i=0;
      while(i!=480)
      {   putpixel(320,i,1);
 i++;
      }

      i=0;
      while(i!=640)
      {  putpixel(i,240,1);
i++;
      }

}
/*
void graph()
{
int k=20, i=0;

     while(k<480)
     {
while(i<640)
{
 putpixel(i,k,5);
 i++;
}
i=0;
k += 20;
     }


k=20, i=0;

     while(k<640)
     {
while(i<480)
{
 putpixel(k,i,5);
 i++;
}
i=0;
k += 20;
     }
}
*/
void func_gen(float precision,float min_range, float max_range, int zoom_factor, int xsh, int ysh)
{
 cleardevice();
// graph();
 drawAxis();
 yx1(min_range, max_range);
 yx2(min_range, max_range);

  int color=(34);
  float x=min_range;
    while(x<=max_range)
    { float y;

      y = graphFunction(x);    //define a function
//   outtextxy(0,0,"Func_gen By Sunil Kumar Dheendhwal");

    float xcord=320+zoom_factor*x+xsh;
    float ycord=240-zoom_factor*y+ysh;

    if((xcord<=640 && xcord>=0) && (ycord>=0 && ycord<=480))
putpixel(xcord,ycord,random(color));
x=x+precision;
    }
}


float graphFunction(float x)
{

return x+10;

}

constructer and distructer in C++ and OOP'S


#include<iostream.h>
#include<conio.h>
int count=0;
class alpha
{
public:
alpha()
{
count++;
cout<<"Call of constructer ="<<count<<endl;
}
~alpha()
{
cout<<"Call of distructer="<<count<<endl;
count--;
}
};
void main()
{
clrscr();
{
alpha a1,a2,a3 ;
{
cout<<"Enter into the block";
alpha a4 ;
cout<<"Exit from the block";
}
}
getch();
}

File HAndling In C++ Or OOP'S


#include<fstream.h>
#include<process.h>
int main()
{
char ch;
ofstream of("team.doc");
if(!of)
{
cerr<<"file cannot open correctly";
exit(-1);
}
cin.get(ch);
while(ch!='\n')
{
of.put(ch);
cin.get(ch);
}
return 0;
}

Saturday, 20 April 2013

How To Make A Clock By Using C++ And OOPS Language


How To Make A Clock By Using C++ And OOPS Language
Copy This Given text And Save With the name of Clock.cpp In A Notepad File And Compile By this Your C Complier

#include<stdio.h>
#include<process.h>
#include<iostream.h>
#include<dos.h>
#include<graphics.h>
#include<conio.h>
#include<math.h>
void draw()
{
setbkcolor(0);
setlinestyle(0,0,0);
setcolor(9);
circle(320,240,3);
setcolor(11);
setfillstyle(6,13);
circle(320,240,150);
circle(320,240,165);
floodfill(156,242,11);
settextstyle(2,0,5);
setcolor(14);
outtextxy(314,98,"12");
outtextxy(384,114,"1");
outtextxy(434,163,"2");
outtextxy(454,230,"3");
outtextxy(317,369,"6");
outtextxy(177,230,"9");
outtextxy(436,300,"4");
outtextxy(195,302,"8");
outtextxy(195,163,"10");
outtextxy(244,112,"11");
outtextxy(388,353,"5");
outtextxy(248,353,"7");
}
main()
{

int gd=0,gm;
initgraph(&gd,&gm,"c:\tc\bgi");

draw();
//line(320,240,320,130);
//line(320,240,320,150);
//getch();
float s;
float df;
//s=282*M_PI/180;
//float angle=4.712389;
//float an=4.712389;
float anf=4.712389;

//float angle=0;
int x,y;
int q,w;
int ta,d;

float as;
as=6*M_PI/180;

int c2=0;
int count=0;
struct  time t;
gettime(&t);
float angle=4.712389+t.ti_sec*.1047198;
float an=4.712389+t.ti_min*.1047198;
while(!kbhit())
{
draw();
gettime(&t);
gotoxy(5,5);
angle=4.712389+t.ti_sec*.1047198;
an=4.712389+t.ti_min*.1047198;
anf=4.712389+t.ti_hour*5*.1047198 ;
if(t.ti_min>=12&&t.ti_min<24)
{
anf=anf+2*.1047198;
}
if(t.ti_min>=24&&t.ti_min<36)
{
anf=anf+(3*.1047198);
}
if(t.ti_min>=36&&t.ti_min<48)
{
anf=anf+(4*.1047198);
}
if(t.ti_min>=48&&t.ti_min<60)
{
anf=anf+(5*.1047198);
}


gotoxy(2,2);
printf("The current time is: %d: %d: %d", t.ti_hour, t.ti_min, t.ti_sec, t.ti_hund);

cout<<"   ";
setlinestyle(0,0,0);
setcolor(0);
line(320,240,x,y);
line(320,240,q,w);
line(320,240,ta,d);

x=320+140*cos(angle);
y=240+140*sin(angle);
q=320+122*cos(an);
w=240+122*sin(an);
ta=320+86*cos(anf);
d=240+86*sin(anf);
setcolor(10);
setlinestyle(0,0,0);
line(320,240,x,y);
setlinestyle(0,0,2);
setcolor(9);
line(320,240,q,w);
setlinestyle(0,0,3);
setcolor(4);
line(320,240,ta,d);
angle+=.1047198;
delay(1000);
count++;

/*if(c2==12)
{
setlinestyle(0,0,3);
c2=0;
anf+=.1047198;
} */
setcolor(count);
outtextxy(370,440,"MADE BY :- Sunil Kumar Dheendhwal");
outtextxy(390,460,"BOSS OF PROGRAMMING");

}


getch();
}

Sunday, 14 April 2013

How To Start Programming With C++ And OOPS



when You Installed Turbo C and C++ after that you want to know how to start programming

Here I will tell you that
Open DosBox That Is On Your Desktop(As A shortcut of DosBox)
when It open Click On "File" after that on "new"
now you seen a blue page
click on it
write the first is headerfils
header files are
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<math.h>
#include<graphics.h>
//etc..........
//after that you need to write any message but before that
//you need to write the main body so write
main()
{
//now you start your programme's body
//here you can write your msg
//for writing messege neet to put the command and the command is
//"cout" now see how can use this command
cout<<"My First C Programme";
getch();
}

now your programme is ready

see your fully programme that will show Your message"My First C Programme" is

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<math.h>
#include<graphics.h>
main()
{
cout<<"My First C Programme";
getch();
}

and most importent is this before run this save with .cpp name
like that myfirst.cpp of no1.cpp or myprog.cpp
but always have .c exetensen

Any More Info Click on Any Other post
any Help Comment here

Monday, 8 April 2013

Real And Img Part In C++ And OOPS



#include<iostream.h>#include<conio.h>
class complex
{
float x,y;
public:
complex()
{}
complex (float real, float imag)
{
x=real;
y=imag;
}
complex operator +(complex c)
{
complex temp;
temp.x=x+c.x;
temp.y=y+c.y;
return(temp);
}
void display()
{
cout<<x<<"+i"<<y;
}
};
void main()
{
clrscr();

complex  c1(1.2,3.4);
complex c2(5.6,7.8);
complex c3;
c3=c1+c2;
cout<<"\nC1:-";
c1.display();
cout<<"\nC2:-";
c2.display();
cout<<"\nC3:-";
c3.display();
getch();
}

Static Programme in C++




#include<iostream.h>
#include<conio.h>
class test
{
int code;
static int count;
public:
void setcode()
{
code=++count;
}
void showcode()
{
cout<<"\n Code:-"<<code<<endl;
}
static void showcount()
{
cout<<"\n Count:-"<<count<<endl;
}
};
int test :: count;
void main()
{
clrscr();
test t1,t2;
test::showcount();
t1.setcode();
t1.showcode();
test::showcount();
t2.setcode();
t2.showcode();
test::showcount();
t1.showcode();
t2.showcode();
getch();
};


How To make a table in C++




#include<iostream.h>
#include<conio.h>
void main()
{
int a,i,n;
clrscr();
cout<<"Enter the no:-";
cin>>a;
cout<<"table of n is:-"<<a;
for(i=1;i<=10;i++)
{
n=a*i;
cout<<"\n"<<n;
}
getch();
}

/*Output:-
Enter the no:-9
table of n is:-9
9
18
27
36
45
54
63
72
81
90*/




Marquee In C++ Or Marquee In OOPS Or Running Line In C++






#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<graphics.h>
#include<dos.h>
void main()
{
int gd=DETECT,gm;
int i;
initgraph(&gd,&gm,"c:\\tc\\bgi");
settextstyle(1,0,2);
settextjustify(1,1);
for(i=0;i<getmaxx();i++)
{
setcolor(i);
outtextxy(getmaxx()-i,getmaxy()/20,"SUNIL KUMAR DHEENDHWAL");
sound(((i+5)%10)*1000);
delay(20);
setcolor(getbkcolor());
outtextxy(getmaxx()-i,getmaxy()/20,"SUNIL KUMAR DHEENDHWAL");
nosound();
}
getche();
}

HOW TO MAKE Matrix By Sum Of Two MatRix And By Multy Of Two Matrix


#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<math.h>
class A
{
int a[3][3],b[3][3],c[3][3],d[3][3],i,j,z,s,t;
public:
A()
{
cout<<"Enter the element of A matrix = ";
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
cin>>a[i][j];
}
}
cout<<"Enter the element of B matrix = ";
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
cin>>b[i][j];
}
}
}
A(int x, int y)
{
s=x;
t=y;
}
void sum()
{
z=s+t;
cout<<"sum of 3 and 5 is= "<<z;
}
void fact()
{
cout<<"matrix A is = f\n";

for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
cout<<a[i][j];
}
cout<<"\n";
}
cout<<"matrix B is = \n";

for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
cout<<b[i][j];
}
cout<<"\n";
}



for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
c[i][j]=a[i][j]*b[i][j];
d[i][j]=a[i][j]+b[i][j];
 }
 }
cout<<"matrix of multy of A and B is= \n";
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
cout<<c[i][j]<<" ";
}
cout<<"\n";
}
cout<<"matrix of sum of A and B is= \n";
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
cout<<d[i][j]<<" ";
}
cout<<"\n";
}
}
};
void main()
{
clrscr();
A x;
x.fact();
A x2(3,5);
x2.sum();

getch();
}



Sunday, 31 March 2013

Preparing to Program Of C++


C++, perhaps more than other languages, demands that the programmer design the program before writing it. Trivial problems, such as the ones discussed in the first few chapters of this book, don't require much design. Complex problems, however, such as the ones professional programmers are challenged with every day, do require design, and the more thorough the design, the more likely it is that the program will solve the problems it is designed to solve, on time and on budget. A good design also makes for a program that is relatively bug-free and easy to maintain. It has been estimated that fully 90 percent of the cost of software is the combined cost of debugging and maintenance. To the extent that good design can reduce those costs, it can have a significant impact on the bottom-line cost of the project.


The first question you need to ask when preparing to design any program is, "What is the problem I'm trying to solve?" Every program should have a clear, well-articulated goal, and you'll find that even the simplest programs in this book do so.


The second question every good programmer asks is, "Can this be accomplished without resorting to writing custom software?" Reusing an old program, using pen and paper, or buying software off the shelf is often a better solution to a problem than writing something new. The programmer who can offer these alternatives will never suffer from lack of work; finding less-expensive solutions to today's problems will always generate new opportunities later.

Assuming you understand the problem, and it requires writing a new program, you are ready to begin your design.

How C++ Evolved????


As object-oriented analysis, design, and programming began to catch on, Bjarne Stroustrup took the most popular language for commercial software development, C, and extended it to provide the features needed to facilitate object-oriented programming. He created C++, and in less than a decade it has gone from being used by only a handful of developers at AT&T to being the programming language of choice for an estimated one million developers worldwide. It is expected that by the end of the decade, C++ will be the predominant language for commercial software development.




While it is true that C++ is a superset of C, and that virtually any legal C program is a legal C++ program, the leap from C to C++ is very significant. C++ benefited from its relationship to C for many years, as C programmers could ease into their use of C++. To really get the full benefit of C++, however, many programmers found they had to unlearn much of what they knew and learn a whole new way of conceptualizing and solving programming problems.

C++ and Object-Oriented Programming


C++ fully supports object-oriented programming, including the four pillars of object-oriented development: encapsulation, data hiding, inheritance, and polymorphism. Encapsulation and Data Hiding When an engineer needs to add a resistor to the device she is creating, she doesn't typically build a new one from scratch. She walks over to a bin of resistors, examines the colored bands that indicate the properties, and picks the one she needs. The resistor is a "black box" as far as the engineer is concerned--she doesn't much care how it does its work as long as it conforms to her specifications; she doesn't need to look inside the box to use it in her design.
The property of being a self-contained unit is called encapsulation. With encapsulation, we can accomplish data hiding. Data hiding is the highly valued characteristic that an object can be used without the user knowing or caring how it works internally. Just as you can use a refrigerator without knowing how the compressor works, you can use a well-designed object without knowing about its internal data members.
Similarly, when the engineer uses the resistor, she need not know anything about the internal state of the resistor. All the properties of the resistor are encapsulated in the resistor object; they are not spread out through the circuitry. It is not necessary to understand how the resistor works in order to use it effectively. Its data is hidden inside the resistor's casing.

C++ supports the properties of encapsulation and data hiding through the creation of user-defined types, called classes. You'll see how to create classes on Day 6, "Basic Classes." Once created, a well-defined class acts as a fully encapsulated entity--it is used as a whole unit. The actual inner workings of the class should be hidden. Users of a well-defined class do not need to know how the class works; they just need to know how to use it. Inheritance and Reuse When the engineers at Acme Motors want to build a new car, they have two choices: They can start from scratch, or they can modify an existing model. Perhaps their Star model is nearly perfect, but they'd like to add a turbocharger and a six-speed transmission. The chief engineer would prefer not to start from the ground up, but rather to say, "Let's build another Star, but let's add these additional capabilities. We'll call the new model a Quasar." A Quasar is a kind of Star, but one with new features.

Introduction With A Brief History of C++

Computer languages have undergone dramatic evolution since the first
electronic computers were built to assist in telemetry calculations during

World War II. Early on, programmers worked with the most primitive 
computer instructions: machine language. These instructions were represented 
by long strings of ones and zeroes. Soon, assemblers were invented to map 
machine instructions to human-readable and -manageable mnemonics, such
 as ADD and MOV.





In time, higher-level languages evolved, such as BASIC and COBOL. 
These languages let people work with something approximating words and 
sentences, such as Let I = 100. These instructions were translated back 
into machine language by interpreters and compilers. An interpreter translates
a program as it reads it, turning the program instructions, or code, directly into 
actions. A compiler translates the code into an intermediary form. This step is 
called compiling, and produces an object file. The compiler then invokes a linker, 
which turns the object file into an executable program.




Today you will get started on your way to becoming a proficient C++ programmer. You'll learn
  • Why C++ is the emerging standard in software development.
  • The steps to develop a C++ program.
  • How to enter, compile, and link your first working C++ program.

Saturday, 30 March 2013

WEL_COME to C++ Universe


Hey Dear Welcome To C++ World
Here we made this blog to improve your knowledge about
 C++ programming and help to improve your
computer programming knowledge.......................

Here we are specially going to help our those friends who
have troubles in programming.............................

In this blog we started with basic Knowledge to Upgredetion so
that you can learn Programming very easily..............................



                                 -- SUNIL KUMAR MUKESH KUMAR