Pages

Write a program to in C++ to get student name and age and print it on screen using OOP technique.

Monday, 22 April 2013


#include<iostream>
using namespace std;
class student{
char name;
int age;
public:
void setname(char newname,int newage)
{
name=newname;
age=newage;
}
void display()
{
    cout<<"your name is "<<name<<"\nYour age is "<<age<<endl;
}
};
int main()
{
student data;
data.setname('ammar',12);
data.display();
system("pause");
}

 

Search Box

Most Reading

Contact Form

Name

Email *

Message *