Structure to enter Details of a person.
#include<iostream>
using namespace std;
struct person
{
char name[50];
int age;
int salary;
};
int main()
{
person p1;
cout<<"Enter your name :";
cin.get(p1.name,50);
cout<<"Enter your age :";
cin>>p1.age;
cout<<"Enter your salary :";
cin>>p1.salary;
for(int i=1;i<=5;i++)
{
cout<<"\nName: "<<p1.name<<endl<<"Age: "<<p1.age<<endl<<"Salary: "<<p1.salary<<endl;
}
return 0;
}
Comments
Post a Comment