Answer to Question #205466 in C++ for Amir khan

Question #205466

Q2. Write a program to define four structures with structure variable of array types. Enter data into each structure variable that has four records and each record contains five fields.


1
Expert's answer
2021-06-11T00:10:15-0400
#include <iostream>
struct Struct1
       {
            int a[5];
            int b[5];
            int c[5];
            int d[5];
       };


using namespace std;


int main()
{
    struct Struct1 s;
    cout<<"Enter details for a: \n";
    for(int i=0;i<5;i++)
        cin>>s.a[i];
    cout<<"Enter details for b: \n";
    for(int i=0;i<5;i++)
        cin>>s.b[i];
    cout<<"Enter details for c: \n";
    for(int i=0;i<5;i++)
        cin>>s.c[i];
    cout<<"Enter details for d: \n";
    for(int i=0;i<5;i++)
        cin>>s.d[i];
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog