On Tue, 24 Jul 2007 07:42:04 -0000
"parrot_rabbit4u" <[EMAIL PROTECTED]> wrote:

> --- In [email protected], "demzeyretrita" <[EMAIL PROTECTED]> 
> wrote:
> >
> > can someone send me sample programs in C++..
> >
> Here I am sending a sample program.
> 
> class test //class name
> {
>           int a;  //private member
>           public
>           void display()
>           {
>             a=10;
>            cout<<"a=",a;
>           }
> } //end of class
> void main()
> {
>       test t;  //object of class test
>       t.display();  //we can acess members of class using objects
> }
> 
> NOTE  :  U HAVE TO REFER TEXT BOOK (OR)USE INTERNET FACILITY FOR THIS.

You won't find the above in a book. Here is a corrected version:

#include <iostream>

using namespace std;

class test { //class name
        int a;  //private member

public:
        void display() {
                a=10;
                cout << "a=" << a << endl;
        }
}; //end of class

int main() {
        test t;  //object of class test
        t.display();  //we can acess members of class using objects
        return(0);
}

Just out of curiosity, why do you use 6 spaces for tab? Seems like a
company policy where equally sized groups could not decide on 4/8.

-- 
The 28.8 frame relay to 3rd floor is toast because of All your base are
belong to us. Teleport is rolling a bone.
:: http://www.s5h.net/ :: http://www.s5h.net/gpg


[Non-text portions of this message have been removed]

Reply via email to