by Dinesh Thakur Category: Array Pointer and Union

 

#include<iostream.h>

#include<conio.h>
void main()
{
              struct student
           {
                   int rn;
                   float fees;
            }st[10], *p;
                int n,j,q=0;
                clrscr();
                cout<<"\nHow Many Students have Data : ";
                cin>> n;
                cout<<"\nEnter the data :";
                for(p=st; p< st+n; p++)
                    {
                           q++;
                           cout<<"\nEnter the Roll No of "<<q<<" Student : ";
                           cin>>p->rn;
                           cout<<"\nEnter the Fee of "<<q<<" Student : ";
                           cin>>p->fees;
                    }
                           p=st;
                           cout<<"\nYour Entered Data is:";
                           q=0;
                           while(p< st+n)
                                 {
                                        q++;
                                        cout<< "\nRoll No of "<<q<<" Student : "<< p->rn;
                                        cout<< "\nFee of "<<q<<" Student is : "<< p->fees;
                                        p++;
                                 }
                                         getch();
}

Display Student Data By Using Structure With Pointer



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles