#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
struct student
{
char *name;
int rn;
float age;
};
void main()
{
struct student *s,*s1;
clrscr();
int n;
void read(student *,int);
void display(student *,int);
cout<<"enter the number of student ";
cin>>n;
s=s1;
read(s,n);
s=s1;
display(s,n);
getch();
}
void read(student *t,int n)
{
int i;
for(i=0;i<n;i++)
{
cout<<"\nenter the student "<<i+1<<" record\n";
gets((t+i)->name);
//s->name=nam;
//cin>>(t+i)->name;
cin>>(t+i)->rn;
cin>>(t+i)->age;
}
}
void display(student *s,int n)
{
int i;
//cout<<"enter the number of student ";
//cin>>n;
for(i=0;i<n;i++)
{
cout<<"\nthe student "<<i+1<<" record\n";
cout<<"name of student ";
puts((s+i)->name);
//cout<<(s+i)->name;
cout<<"\nroll number "<<(s+i)->rn;
cout<<"\nage "<<(s+i)->age;
cout<<"\n";
}
}
#include<conio.h>
#include<string.h>
#include<stdio.h>
struct student
{
char *name;
int rn;
float age;
};
void main()
{
struct student *s,*s1;
clrscr();
int n;
void read(student *,int);
void display(student *,int);
cout<<"enter the number of student ";
cin>>n;
s=s1;
read(s,n);
s=s1;
display(s,n);
getch();
}
void read(student *t,int n)
{
int i;
for(i=0;i<n;i++)
{
cout<<"\nenter the student "<<i+1<<" record\n";
gets((t+i)->name);
//s->name=nam;
//cin>>(t+i)->name;
cin>>(t+i)->rn;
cin>>(t+i)->age;
}
}
void display(student *s,int n)
{
int i;
//cout<<"enter the number of student ";
//cin>>n;
for(i=0;i<n;i++)
{
cout<<"\nthe student "<<i+1<<" record\n";
cout<<"name of student ";
puts((s+i)->name);
//cout<<(s+i)->name;
cout<<"\nroll number "<<(s+i)->rn;
cout<<"\nage "<<(s+i)->age;
cout<<"\n";
}
}
No comments:
Post a Comment