by Dinesh Thakur Category: Array Pointer and Union

 

#include<conio.h>

#include<iostream.h>
void main()
{
      union student
        {
                char grade;
                int rollno;
                float marks;
                double fees;
         }s;
                clrscr();
                cout<<"Enter the Garde of the Student : ";
                cin>>s.grade;
                cout<<"Grade is :"<<s.grade<<endl;
                cout<<"Enter the RollNo of the Student : ";
                cin>>s.rollno;
                cout<<"Rollno is:"<<s.rollno<<endl;
                cout<<"Enter the Marks of the Student : ";
                cin>>s.marks;
                cout<<"Marks are :"<<s.marks<<endl;
                cout<<"Enter the Fees of the Student : ";
                cin>>s.fees;
                cout<<"Fees paid is: "<<s.fees;
                getch();
}

Read And Display Student Data Using Union



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