Write a C++ Program to Store Information of a Student in a Structure

C++ Program to Store Information of a Student in a Structure

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn C++ programming concepts. You can learn C++ language at your own speed and time. One can learn concepts of C++ language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

C++ Program to Store Information of a Student in a Structure
C++ Program to Store Information of a Student in a Structure

Write a C++ Program to Store Information of a Student in a Structure

PROGRAM:C++ Program to Store Information of a Student in a Structure

/* C++ Program to Store Information of a Student in a Structure */

#include <iostream>
using namespace std;

struct student
{
char name[50];
int roll;
float marks;
};

int main()
{
student s;
cout << “Enter information,” << endl;
cout << “Enter name: “;
cin >> s.name;
cout << “Enter roll number: “;
cin >> s.roll;
cout << “Enter marks: “;
cin >> s.marks;

cout << “\nDisplaying Information,” << endl;
cout << “Name: ” << s.name << endl;
cout << “Roll: ” << s.roll << endl;
cout << “Marks: ” << s.marks << endl;
return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *