0% found this document useful (0 votes)
15 views2 pages

It2b1 Practice-5 Structures 18102023

The document is a C++ program that defines a 'Student' structure to store student information including ID, name, contact, address, and fee. It prompts the user to input details for two students and then displays the entered information. The program also contains commented-out code for displaying the sizes of various data types and the structure itself.

Uploaded by

cnj59dbpzs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

It2b1 Practice-5 Structures 18102023

The document is a C++ program that defines a 'Student' structure to store student information including ID, name, contact, address, and fee. It prompts the user to input details for two students and then displays the entered information. The program also contains commented-out code for displaying the sizes of various data types and the structure itself.

Uploaded by

cnj59dbpzs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

// IT2B1_PRACTICE-5_Structures_18102023.

cpp : This file contains the 'main'


function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;
//User-defined Datatype 'Student'
struct Student
{
// Data Members
int Stu_ID;
string Stu_Name, Stu_Contact, Stu_Address;
double Stu_Fee;
};

int main()
{
Student S1, S2; //Structure Variable
cout << "\n**************** INPUT-1 ******************" << endl;
cout << "\tEnter Student ID: "; cin >> S1.Stu_ID;
cout << "\tEnter Student Name: "; cin >> S1.Stu_Name;
cout << "\tEnter Student Contact: "; cin >> S1.Stu_Contact;
cout << "\tEnter Student Address: "; cin >> S1.Stu_Address;
cout << "\tEnter Student Fee: "; cin >> S1.Stu_Fee;

cout << "\n**************** INPUT-2 ******************" << endl;


cout << "\tEnter Student ID: "; cin >> S2.Stu_ID;
cout << "\tEnter Student Name: "; cin >> S2.Stu_Name;
cout << "\tEnter Student Contact: "; cin >> S2.Stu_Contact;
cout << "\tEnter Student Address: "; cin >> S2.Stu_Address;
cout << "\tEnter Student Fee: "; cin >> S2.Stu_Fee;

cout << "\n\n**************** OUTPUT-1 ******************" << endl;


cout << "\tStudent ID: " << S1.Stu_ID << endl;
cout << "\tStudent Name: " << S1.Stu_Name << endl;
cout << "\tStudent Contact: " << S1.Stu_Contact << endl;
cout << "\tStudent Address: " << S1.Stu_Address << endl;
cout << "\tStudent Fee: " << S1.Stu_Fee << endl;

cout << "\n\n**************** OUTPUT-2 ******************" << endl;


cout << "\tStudent ID: " << S2.Stu_ID << endl;
cout << "\tStudent Name: " << S2.Stu_Name << endl;
cout << "\tStudent Contact: " << S2.Stu_Contact << endl;
cout << "\tStudent Address: " << S2.Stu_Address << endl;
cout << "\tStudent Fee: " << S2.Stu_Fee << endl;

system("Pause");
return 0;
}

/*
cout << "\tSize of One Integer Variable: " << sizeof(int) << " Bytes." << endl;
cout << "\tSize of One Double Variable: " << sizeof(double) << " Bytes." <<
endl;
cout << "\tSize of One String Variable: " << sizeof(string) << " Bytes." <<
endl;
cout << "\tSize of One Structure Variable: " << sizeof(S1) << " Bytes." <<
endl;
cout << "\tSize of One Structure Variable: " << sizeof(Student) << " Bytes." <<
endl;
*/

You might also like