by Dinesh Thakur Category: Array Pointer and Union


#include <iostream.h>

#include <string.h>
struct student
       char firstName[20];
       char lastName[20];
       char SSN[10];
       float gpa;
             void main()
                struct student st1 ;
                strcpy(st1.firstName, "Dinesh");
                strcpy(st1.lastName, "Thakur");
                strcpy(st1.SSN, "228378" );
                st1.gpa = 22009.20;
                cout<<"First Name: "<< st1.firstName<<endl;             
                cout<<"Last Name:"<<st1.lastName<<endl;
                cout<<"SNN : "<<st1.SSN<<endl;
                cout<<"GPA: "<<st1.gpa<<endl;

read and write the student data by using structure

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