by Dinesh Thakur Category: Array Pointer and Union



void main()
      union student
                char grade;
                int rollno;
                float marks;
                double fees;
                cout<<"Enter the Garde of the Student : ";
                cout<<"Grade is :"<<s.grade<<endl;
                cout<<"Enter the RollNo of the Student : ";
                cout<<"Rollno is:"<<s.rollno<<endl;
                cout<<"Enter the Marks of the Student : ";
                cout<<"Marks are :"<<s.marks<<endl;
                cout<<"Enter the Fees of the Student : ";
                cout<<"Fees paid is: "<<s.fees;

Read And Display Student Data Using Union

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, 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