google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.

Monday, February 23, 2015

Write a visual Basic Program to show tool bar

Designing Window :-
First step right click on toolbox and add components it will show components popup window from it on control tab add Microsoft Windows Common Controls 6.0 (SP6) click on check box of selected items only and then click on OK button .It will show more tools like tool bar and image list on toolbox take it on form window and write the below code in coding window.


                            Fig :- Design View of program for taking tool bar on form


Code:-

Private Sub Form_Load()
Toolbar1.ImageList = ImageList1
Dim b1 As Button
Set b1 = Toolbar1.Buttons.Add
b1.Style = tbrDefault
b1.Caption = "New"
b1.Image = 1

Dim b2 As Button
Set b2 = Toolbar1.Buttons.Add
b2.Style = tbrDefault
b2.Caption = "Open"
b2.Image = 2

Dim b3 As Button
Set b3 = Toolbar1.Buttons.Add
b3.Style = tbrDefault
b3.Caption = "Save"
b3.Image = 3

Dim b4 As Button
Set b4 = Toolbar1.Buttons.Add
b4.Style = tbrDefault
b4.Caption = "Copy"
b4.Image = 4

Dim b5 As Button
Set b5 = Toolbar1.Buttons.Add
b5.Style = tbrDefault
b5.Caption = "Paste"
b5.Image = 5
End Sub


=============================================
OUTPUT


Write a C++ program to calculate area of circle,sphere and cylinder using base class round-shape

Create a base class round-shape(radius). define three different
shapes as circle, sphere and cylinder(height) from round-shape.
class round-shape
{
protected :float radius;
public:static float pi;
round-shape(float)//default argument
virtual float area()=0;
}
Write a C++ program to calculate area of circle,sphere and cylinder



#include<iostream.h>
#include<conio.h>
class round
{
protected:float radius;
public:static float pi;
       round(float r=0)
       {
       cout<<"\n Enter the radius:-";
       cin>>r;
       radius=r;
       }
       virtual float area()=0;
       };
class circle:public round
{
public:float circle;
       float area()
       {
       circle=pi*radius*radius;
       cout<<"\n Area of circle:-"<<circle;
       return 0;
       }
       };
class sphere:public round
{
public:float sph;
       float area()
       {
       sph=4*pi*radius*radius;
       cout<<"\n Area of sphere:-"<<sph;
       return 0;
       }
};
class cylinder:public round
{
public:float ac;
       float h;
public:cylinder(float height=0)
       {
       cout<<"\n Enter height:-";
       cin>>height;
       h=height;
       }
       float area()
       {
       float tsac,csac,vc,acbc;
       tsac=2*pi*radius*(h+radius);
       csac=2*pi*radius*h;
       vc=pi*radius*radius*h;
       acbc=pi*radius*radius;
       ac=tsac+csac+vc+acbc;
       cout<<"Area of cylinder is:-"<<ac;
       return 0;
       }
};
float round::pi=3.14;
int main()
{
int height;
clrscr();
cout<<"\n\t\t To calculate area of circle\n\n";
circle c;
c.area();
cout<<"\n\t\t To calculate area of sphere\n\n";
sphere s;
s.area();
cout<<"\n\t\t To calculate area of cylinder\n\n";
cylinder cl;
cl.area();
getch();
return 0;
}






============================================
OUTPUT

                To calculate area of circle                                    
                                                                               
                                                                               
Enter the radius:-1                                                           
                                                                               
Area of circle:-3.14         
                                                 
                To calculate area of sphere                                    
                                                                               
                                                                               
Enter the radius:-1                                                           
                                                                               
Area of sphere:-12.56  
                                                       
                To calculate area of cylinder                                  
                                                                               
                                                                               
Enter the radius:-1                                                           
                                                                               
Enter height:-1
Area of cylinder is:-25.120001

अच्छे विचार करे विचार

  पहचान की नुमाईश, जरा कम करें... जहाँ भी "मैं" लिखा है, उसे "हम" करें... हमारी "इच्छाओं" से ज़्यादा "सुन...