A SIMPLE PROGRAM USING INITIALISATION FUNCTION

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
class A
{
char name[10];
int roll;
char c[5];
public:
void getd()
 {
 cout<<"enter the name"<<"\n";
 gets(name);
 cout<<"enter the roll number"<<"\n";
 cin>>roll;
 cout<<"enter the class"<<"\n";
 gets(c);
 }
void putd()
 {
 cout<<"name is  "<<puts(name);
 cout<<"roll number is  "<<roll<"\n";
 puts(c);
 }
void init()
 {
 strcpy(name,"Utkarsh");
 roll=44;
 strcpy(c,"XII A");
 }
};
void main()
{
clrscr();
A a;
a.getd();
a.putd();
cout<<"values after init function used are";
a.init();
a.putd();
getch();
}

Comments

Popular Posts