Sunday, January 17, 2021

Structure in c++ with Eaglesoft.

 


#include<iostream>
using namespace std;
struct eaglesoft  
{
    char name[50];
    char role[50];
    int salary;
};
int main()
{
     eaglesoft e1[2000];

     for(int i=0;i<2000;i++)
     {
         cout<<"Enter recor #"<<i+1<<" :"<<endl;
         cout<<"Enter the name of Eaglesoft Eagle: "<<endl;
         cin>>e1[i].name;
         cout<<"Enter the role of Eaglesoft Eagle: "<<endl;
         cin>>e1[i].role;
         cout<<"Enter the salary of Eaglesoft Eagle: "<<endl;
         cin>>e1[i].salary;
    
     } 
     int ch;
    cout<<"Press 1 for get data of "<<e1[0].name<<" "<<endl;
    cout<<"Press 2 for get data of "<<e1[1].name<<" "<<endl;
    cout<<"Press 3 for get data of "<<e1[2].name<<" "<<endl;
    cout<<"Press 4 for get data of "<<e1[3].name<<" "<<endl;
    cin>>ch;
    if(ch==1)
    {
        cout<<"***********Details of "<<e1[0].name<<"*********** "<<endl;
        cout<<"Name:"<<e1[0].name<<endl;
        cout<<"Role:"<<e1[0].role<<endl;
        cout<<"Salary:"<<e1[0].salary<<endl;
    }
    else if(ch==2)
        {
        cout<<"***********Details of "<<e1[1].name<<"*********** "<<endl;
        cout<<"Name:"<<e1[1].name<<endl;
        cout<<"Role:"<<e1[1].role<<endl;
        cout<<"Salary:"<<e1[1].salary<<endl;
    }
    else if(ch==3)
        {
        cout<<"***********Details of "<<e1[2].name<<"*********** "<<endl;
        cout<<"Name:"<<e1[2].name<<endl;
        cout<<"Role:"<<e1[2].role<<endl;
        cout<<"Salary:"<<e1[2].salary<<endl;
    }
    else if(ch==4)
        {
        cout<<"***********Details of "<<e1[3].name<<"*********** "<<endl;
        cout<<"Name:"<<e1[3].name<<endl;
        cout<<"Role:"<<e1[3].role<<endl;
        cout<<"Salary:"<<e1[3].salary<<endl;
    }
    else  
    {
        cout<<"invalid input! There is no such Eagle in Eaglesoft"<<endl;
    }
 
    return 0;
}

No comments:

Post a Comment