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

Saturday, February 28, 2015

Write a c++ program using class to overload the operator unary increment ++ for an integer number.

Write a c++ program using class to overload the operator unary increment ++ for an integer number.


#include<conio.h>
#include<iostream.h>
class increment
{
public:int no;
public:void getdata()
       {
       cout<<"\n Enter the number:-";
       cin>>no;
       }
       void operator ++()
       {
       no=no+1;
       }
       void display()
       {
       cout<<"\n The number after increment is:-"<<no;
       }
};
int main()
{
increment i;
clrscr();
i.getdata();
++i;
i.display();
getch();
return 0;
}


=========================================

OUTPUT
Enter the number:-2

The number after increment is:-3

Friday, February 27, 2015

VB program to dispaly age from birth date

Design Window:-


Code:

Private Sub cmdClear_Click()
    Text1.Text = ""
    Text2.Text = ""
    Text1.SetFocus
End Sub

Private Sub cmdDisplay_Click()
    Dim b As Date
    Dim d As Date
    Dim age As Date
    b = Text1.Text
    d = Format$(Now, "dd/mm/yyyy hh:mm:ss ")
    age = Format$(d - b, "dd/mm/yyyy hh:mm:ss")
   
    Text2.Text = Year(age)
    Text3.Text = Month(age)
    Text4.Text = Day(age)
    Text5.Text = Hour(age)
    Text6.Text = Minute(age)
    Text7.Text = Second(age)
End Sub

Private Sub cmdExit_Click()
    Unload Me
End Sub
===================================================
OUTPUT

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

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