StudyLover
  • Home
  • Study Zone
  • Profiles
  • Contact us
  • Sign in
StudyLover 15. Program to display names, roll numbers, and grades of 3 students who have appeared in an examination using a class. Create an array of class objects and read and display the contents of the array.
Download
  1. C++ Programs list
14. Program to process a shopping list for a departmental store using a class. The list includes details such as code number and price of each item, and operations like adding, deleting items, and printing the total value of an order. : 16. Program to design a `Student` class representing student roll numbers, and a `Test` class (derived from `Student`) representing the scores in various subjects, and a `Sports` class representing the score in sports. Inherit `Sports` and `Test` classes into a `Result` class to add scores and display the final result for a student.
C++ Programs list

1.      Program to display names, roll numbers, and grades of 3 students who have appeared in an examination using a class. Create an array of class objects and read and display the contents of the array.

  1. #include <iostream.h>

  2. #include<conio.h>

  3. class Student {

  4. public:

  5.     char name[50];

  6.     int rollNo;

  7.     float grade;

  8.  

  9.     void inputDetails() {

  10.                 cout << "Enter name: ";

  11.                 cin >> name;

  12.                 cout << "Enter roll number: ";

  13.                 cin >> rollNo;

  14.                 cout << "Enter grade: ";

  15.                 cin >> grade;

  16.     }

  17.  

  18.     void displayDetails() {

  19.                 cout << "Name: " << name << endl;

  20.                 cout << "Roll Number: " << rollNo << endl;

  21.                 cout << "Grade: " << grade << endl;

  22.     }

  23. };

  24.  

  25. int main() {

  26.     Student students[3];

  27.     int student_count=0;

  28.     cout << "\nEnter the number of students: ";

  29.     cin >> student_count;

  30.     for (int i = 0; i < student_count; i++) {

  31.                 cout << "Enter details for student " << i + 1 << endl;

  32.                 students[i].inputDetails();

  33.     }

  34.  

  35.     cout << "\nStudent Details:\n";

  36.     for (int j = 0; j < student_count; j++) {

  37.                 students[j].displayDetails();

  38.                 cout << endl;

  39.     }

  40.  

  41.  

  42.  

  43.     getch();

  44.     return 0;

  45. }

14. Program to process a shopping list for a departmental store using a class. The list includes details such as code number and price of each item, and operations like adding, deleting items, and printing the total value of an order. 16. Program to design a `Student` class representing student roll numbers, and a `Test` class (derived from `Student`) representing the scores in various subjects, and a `Sports` class representing the score in sports. Inherit `Sports` and `Test` classes into a `Result` class to add scores and display the final result for a student.
Our Products & Services
  • Home
Connect with us
  • Contact us
  • +91 82955 87844
  • Rk6yadav@gmail.com

StudyLover - About us

The Best knowledge for Best people.

Copyright © StudyLover
Powered by Odoo - Create a free website