MY name is ruhul amin

ISLAMIC UNIVERSITY OF KUSHTIA

Saturday, March 9, 2013

using constructor of c++ program

#include<iostream>
#include<cstdio>
using namespace std;
class sample
{
    private:
    int rollno;
    float marks;
    char name;
    public:
    sample(char c)
    {
     name=c;
    }
    void veriation()
    {
     cout<<name;
    }
};
int main()
{
    int i;
    char m[100],g;
    i=0;
    while((g=cin.get())!=EOF)
    {
    sample smp(g);
    smp.veriation();
    }
    return 0;
}

No comments:

Post a Comment