Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

Program to Store Information in Structure and Display it in CPP (C plus plus)

Program to Store Information in Structure and Display it in CPP (C plus plus)

In this tutorial, we will learn about the Program to Store Information in Structure and Display it in CPP (C plus plus). 

#include <iostream>

using namespace std;

struct stu
{
    int rol;
    float marks;
    char n[50];
} 
k[10];

int main()
{
    cout <<"Please enter information of students: "<<endl<<endl;

    
    for(int i=0;i<3;++i)
    {
        k[i].rol = i+1;
        
        cout<<"For Roll No: "<<k[i].rol<<","<<endl;

        cout<<"Please enter name: ";
        cin>>k[i].n;

        cout<<"Please enter marks: ";
        cin>>k[i].marks;

        cout<<endl;
    }

    cout<<"Showing Information: "<<endl;

    for(int i=0;i<10;++i)
    {
        cout<<endl<<"Roll No: "<<i+1<<endl;
        cout<<"Name: " <<k[i].n<<endl;
        cout<<"Marks: "<<k[i].marks<<endl;
    }

    return 0;
}

Output:

Program to Store Information in Structure and Display it in CPP (C plus plus)

Program to Store Information in Structure and Display it in CPP (C plus plus)

Fazal Rehman Shamil Click Here to Know More
Instructor, Researcher, Blogger, SEO Expert, Poet and Publisher of International Journal Of Software, Technology & Science ISSN : 2616 - 5325
Dear Professors and Resarchers!You are welome to Cite these tutorials in your research or slides etc. Please don't forget to mention the reference of website. Copy Paste of text is strcitly forbidden. Images can be reuse because images are protected with watermark.