WHICH PARTY WILL MADE GOVT IN 2014 BJP OR CONGRESS

Saturday, 21 April 2012

HI FRIENDS I AM ADDING HERE 11 PROGRAM OF OOPS IN C++
ALL PROGRAM OF C++TABLE OF CONTENTS




SNO
PROGRAM NAME
PAGE NO
SIGN

1.
Program to find sum, multiplication, subtraction and division of two numbers

1


2.
Program to find the complete no. by area exchange and number of a customer

4


3.
Program to illustrate the concept of this pointer

6


4.
Program to implement simple constructor

8


5.
Program to implement default constructor

10


6.
Program to implement friend function

12


7.
Program for binary operator overloading using friend function

14


8.
Program to overload unary (-) operator

16


9.
Program for a simple constructor

18


10.
Program to find transpose of a matrix using the concept of classes

20


11.
Program to implement destructor which destruct the objects one by one

22


1. Program to find sum ,multiplication,subtraction and division of two numbers.



#include<iostream.h>
#include<conio.h>
#include<process.h>
int main()
{
clrscr();
int a,b,s,m,d,r,ch,e;
char choice;
do
{
cout<<"1. ADDITION \n \n";
cout<<"2. SUBTRACTION \n \n"; cout<<"3. MULTIPLICATION \n \n"; cout<<"4. DIVISION \n \n"; cout<<"Enter Your Choice :";
cin>>ch;
switch(ch)
{
case 1:
cout<<"Enter The Value Of First Variable";
cin>>a;
cout<<"Enter The Value Of Second Variable";
cin>>b;
r=a+b;
cout<<"Result After Addition="<<r<<endl;
break;
case 2:
cout<<"Enter The Value Of First Variable";
cin>>a;
cout<<"Enter The Value Of Second Variable";
cin>>b;
s=a-b;
cout<<"Result After Subtraction="<<s<<endl;
break;
case 3:
cout<<"Enter The Value Of First Variable";
cin>>a;
cout<<"Enter The Value Of Second Variable";
cin>>b;
m=a*b;
cout<<"Result After Multiplication="<<m<<endl;
break;
case 4:


1 | P ag e

cout<<"Enter The Value Of Dividend";
cin>>a;
cout<<"Enter The Value Of Divisor";
cin>>b;
d=(a/b);
e=a%b;
cout<<"Result After Division \n \n"<<"Quotient=" <<d<<"\t"<<"Remainder="<<e<<endl;
break;
default:
cout<<"Wrong Choice Entered \n";
}
cout<<"Do Another(Y/N) ? \n";
cin>>choice;
}
while((choice=='Y')||(choice=='y'));
getch();
}










































2 | P ag e



















3 | P ag e

2. Program to find the complete no. by area exchange and number of a customer.



#include<iostream.h>
#include<conio.h>
#include<process.h>
struct phone
{
int area,xchange,number;
}a,b;
int main()
{
clrscr(); a.area=505; a.xchange=989; a.number=7806;
cout<<"Enter the Area Code, Exchange and Number \n";
cin>>b.area;
cin>>b.xchange;
cin>>b.number;
cout<<"My number is \t"<<a.area<<"-"<<a.xchange<<"-"<<a.number<<"\n"; cout<<"your number is \t"<<b.area<<"-"<<b.xchange<<"-"<<b.number<<"\n"; getch();
}
































4 | P ag e
























5 | P ag e

3.Program to illustrate the concept of this pointer.



#include<iostream.h>
#include<conio.h>
class k
{ int x; public: k()
{ }
k(int a)
{ x=a;
}
k &show()
{  return *this;
}
void display()
{ cout<<x;
} };
void main()
{ clrscr(); k l,l1(60); l=l1.show(); l.display(); getch();
}






























6 | P ag e





























7 | P ag e

4. Write a program to implement simple constructor.

#include<iostream.h>
#include<conio.h>
class multiply
{
int a,b,c; public: multiply()
{ a=0;
b=0;
c=0;
}
void input();
int mul();
void output();
};
void multiply::input()
{
cout<<"\nEnter the value of A:";
cin>>a;
cout<<"\nEnter the value of B:";
cin>>b;
}
int multiply::mul()
{
cout<<"\nMultiplying A and B:";
c=a*b;
return c;
}
void multiply::output()
{
cout<<"\nThe value of c after multiplication of A and B is :";
cout<<c;
}
void main()
{
clrscr();
cout<<"\n\nINPUT THE DATA";
m.input();
cout<<"\n\nMULTIPLICATION OF DATA:";
m.mul();
cout<<"\n\nOUTPUT OF DATA:";
m.output();
getch();
}


8 | P ag e


















9 | P ag e

5.Write a program to inplement default constructor.



#include<iostream.h>
#include<conio.h>
class mobile
{
int no;
float price; public: mobile();
void getdata();
};
mobile::mobile()
{
cout<<"ENTER NO";
cin>>no;
cout<<"ENTER PRICE";
cin>>price;
}
void mobile::getdata()
{
cout<<"NO IS = "<<no<<endl;
cout<<"PRICE IS = "<<price<<endl;
}
void main()
{ clrscr(); mobile m; m.getdata(); getch();
}





















10 | P ag e



















11 | P ag e

6.Write a program to implement friend function.



#include<iostream.h>
#include<conio.h>
class abc;
class pqr
{
int p;
public:
void input(int k)
{
p=k;
}
friend int large(pqr,abc);
};
class abc
{
int d;
public:
void getdata(int s)
{
d=s;
}
friend int large(pqr,abc);
};
large(pqr l,abc b)
{
if(l.p>b.d)
cout<<"\n\nTHE PROGRAM IS CORRECT\n"<<l.p<<"is greater than "<<b.d;
else
cout<<"\n\n THE FUNCTION IS INCORRECT";
return 0;
}
void main()
{       clrscr();
pqr x; x.input(500); abc y; y.getdata(200); large(x,y); getch();
}






12 | P ag e




















13 | P ag e

7.Write a program for binary operator overloading using friend function.



#include<iostream.h>
#include<conio.h>
class complex
{
float real,imag;
public:
complex()
{ real=0; imag=0;
}
complex(float r,float i)
{
real=r;
imag=i;
}
friend complex operator-(complex l,complex k)
{
complex d;
d.real=l.real-k.real; d.imag=l.imag-k.imag; return d;
}
void display()
{
cout<<"\nthe result is\n\t\t"<<real<<"+iota("<<imag<<")";
}
};
void main()
{clrscr();
complex c1(21.2,44.3);
complex c2(14.3,51.4); complex c3; c3=operator-(c1,c2); c3.display();
getch();
}










14 | P ag e


















15 | P ag e

8.Program to overload unary (-) operator.



#include<iostream.h>
#include<conio.h>
class ips
{
int a,b,c;
public:
void enter(int p,int q,int r)
{ a=p; b=q; c=r;
}
void operator-()
{
a=-a;
b=-b;
c=-c;
}
void test()
{ cout<<a<<endl; cout<<b<<endl; cout<<c<<endl;
}
};
void main()
{
clrscr(); ips s; s.enter(50,70,90); s.test();
-s; s.test(); getch();
}













16 | P ag e




































17 | P ag e

9.Program for a simple constructor.



#include<iostream.h>
#include<conio.h>
class XYZ
{
int a,b;
clrscr(); public: XYZ()
{
a=0;
b=0;
}
void show();
};
void XYZ::show()
{
cout<<"Value of a is "<<a<<endl;
cout<<"Value of b is "<<b<<endl;
}
void main()
{
clrscr(); XYZ z1; z1.show(); getch();
}


























18 | P ag e





























19 | P ag e

10. Program to find transpose of a matrix using the concept of classes.



#include<iostream.h>
#include<conio.h>
class matrix
{
int m,n,i,j;
int a[5][5];
public:
void input();
void output();
};
void matrix::input()
{
cout<<"enter the order of a matrix"<<endl;
cin>>m>>n;
cout<<"enter the elements of a matrix whose transpose is to be calculated"<<endl;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cin>>a[i][j];
}
}
}
void matrix::output()
{
cout<<"transpose is\n" ;
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
cout<<a[j][i]<<"\t";
}
cout<<"\n";
}
}
void main()
{
clrscr(); matrix a; a.input(); a.output(); getch();
}


20 | P ag e

























21 | P ag e

11.Program to implement destructor which destruct the objects one by one.



#include<iostream.h>
#include<conio.h>
int a=0;
class dest
{
public:
dest()
{
cout<<"\nthe no. of object created="<<++a;
}
~dest()
{
cout<<"\nthe no. of object ruined="<<a--;
}
};
void main()
{
clrscr();
dest a,b;
{
dest c;
}
dest d;
getch();
}



























22 | P ag e





































23 | P ag e

Sunday, 1 April 2012

ABOUT HTML tutorial

Purpose: Introduce you to basic web page coding. This is a basic tutorial which will prepare you for the use of more sophisticated HTML editing tools.

Importance: Very few people code HTML by hand anymore. There are a multiplicity of programs such as DreamWeaver and Microsoft Front Page which help make the process of web page creation easier. BEFORE you learn to use these tools, it is important to learn the basic structure and components of the code/language. This will come in handy when you need to troubleshoot code which editing tools can't fix.

Goals: After this activity, you will be able to:

• Set up your server account to serve your personal web page

• Build a basic text web page

• Format and stylize your web page font

• Add images to your web page

• Add and control hyperlinks

STEP 1: SETTING UP YOUR SERVER ACCOUNT TO HOST YOUR WEB FILES

You will be creating HTML (Hyper Text Markup Language) documents. These are the files/instructions a browser (i.e. Netscape/Internet Explorer) reads and uses to show web pages. In order to create your own home you need to place your HTML (Hyper Text Markup Language) documents in a world readable directory named "www" in your home directory (on your server account). This directory is automatically created for new accounts, so in most cases you should not need to create it. If it DOES NOT exist (You do not have to do this right now, but can hop over on one of the server machines if you would like to check/do this), open the server and create this directory, using the following commands:

cd

mkdir -p www

fs sa www system:anyuser rl

This creates a directory named www into which you will place all file relating to your homepage. Now, within that directory, you have to create a file (home.html) written in html format. Note that HTML documents MUST end in ".html" or ".htm". We will use ".html" as our standard. Once you have created your home.html file, the URL for that page (your home page) would be: http://web.mit.edu/username/www/home.html. Anyone in the world can view this web page with a browser.

STEP 2: MAKING THE "HTML" WEB FILES

HTML files are text files which contain the code of a web page. Today you will learn how to program some basic HTML code. When beginning, it is best to use a simple text editor such as notepad or emacs. You can open notepad in the following way:

1. Click on the Start Button

2. Click on Run

3. Type in: notepad

4. Press ENTER on the keyboard

The notepad window should pop up, if not, ask for help.

STEP 3: LAYING OUT THE BASIC STRUCTURE OF THE PAGE

HTML files have a basic structure that you MUST work within. Before you begin the tutorial you should type or copy/paste the following 8 lines from this screen into the text file (file you have open in notepad):

<html>

<head>

<title>MY HOME PAGE NAME</title>

</head>

<body>

THIS IS WHERE THE CODE FOR BODY (WHAT YOU SEE IN NETSCAPE/INTERNET EXPLORER) OF THE WEB PAGE GOES.

</body>

</html>

The text/bracket combinations are called tags. Note they come in pairs. There is always a beginning tag (<title>) and an end tag (</title>). The beginning tag signals Netscape / Internet Explorer that a new tag/task is starting. The end tag tells Netscape / Internet Explorer that the tag/task has ended. You will learn more about these in the tutorial. Save the above file to the desk top of your computer as: home.html. Make sure to add the extension ".html" to the end of the file!!!!!

STEP 4: OPENING THE HTML FILE IN NETSCAPE/INTERNETEXPLORER

Now you can view the results of your work:

1. Go to or open Netscape/Internet Explorer

2. File > Open or Open Page

3. Press the Choose or Browse button

4. Browse to the desktop and double click on home.html

5. Click Open/OK to load the file

If this did not work, ask for help.

STEP 5: MAKING YOUR FILES READABLE ON THE WWW

To make your files accessible to the world (later on), you must store them in your server account (You do not have to do right now, but you could ftp the file to the server if you wanted) within the www file. Later on, you can use Emacs or other text editor on the server to edit the home.html file.

STEP 6: USING NETSCAPE/INTERNET EXPLORER AND THE TEXTEDITOR TO UPDATE AND VIEW THE RESULTS

VERY IMPORTANT!!!!!

Instead of copying and pasting the text from the tutorial into the Netscape/Internet Explorer browser text window (as suggested in the "TRY IT YOURSELF SECTIONS!" of the tutorial), you should paste the code into your home.html (inside notepad) file. You can then reload the file into Netscape/Internet Explorer to see the results:

1. Select the text from the tutorial you wish to copy

2. Copy the text by pressing: Ctrl+C (the control and c key simultaneously)

3. Switch to notepad

4. Place the cursor where you want to paste the text

5. Paste the text by pressing Ctrl+V

6. Modify the text/code if you need to

7. Save the file

8. Load the file into Netscape/Internet Explorer, OR if you are already viewing the file in Netscape/Internet Explorer, press the reload (called refresh in Internet Explorer) button to view the page with changes.

Use this procedure to obtain experience in using a text editor and Netscape / Internet Explorer to write and debug your pages.

STEP 7: RUN THE TUTORIAL

Start the tutorial at: http://www.davesite.com/webstation/html/index.shtml. Your job today is to finish chapters 1 - 5 of the tutorial on HTML. Chapter 0 is not necessary. YOU WILL HAVE TO MOVE FAST TO FINISH THIS!!!

- Ch. 1: The Basics [What a tag is, Document Structure]

- Ch. 2: The Common Tags [Headings and Horizontal Ruled Lines]

- Ch. 3: More Common Tags [Paragraphs, Text Formatting, ALIGN, and Line Break]

- Ch. 4: Links and Images

- Ch. 5: A Little More Tags [Centering, BODY, etc.]TML .