C++ structure program of person

In this program we will create structure of person enter data in structure and also show the entered data.

The code is given below.

//Code Starts

#include<iostream>

#include<conio.h>

using namespace std;

struct person

{

char name[15];

char age[2];

char father_name[20];

char adress[40];

char phone[11];

};

int main()

{

person p;

cout<<“Enter Name “<<endl;

cin>>p.name;

cout<<“Enter Father’s Name “<<endl;

cin>>p.father_name;

cout<<“Enter Age “<<endl;

cin>>p.age;

cout<<“Enter Adress “<<endl;

cin>>p.adress;

cout<<“Enter Mobile Number “<<endl;

cin>>p.phone;

cout<<“Your Entered Data :”<<endl;

cout<<p.name<<endl;

cout<<p.age<<endl;

cout<<p.father_name<<endl;

cout<<p.adress<<endl;

cout<<p.phone<<endl;

getch();

}

//Code Ends

OUTPUT:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s