answersLogoWhite

0

Here's a simple C++ program that allows you to input student information, display it, and search for a student by their registration number:

#include <iostream>
#include <vector>
#include <string>

struct Student {
    std::string name;
    int regNumber;
};

int main() {
    std::vector<Student> students;
    int n;

    std::cout << "Enter number of students: ";
    std::cin >> n;
    for (int i = 0; i < n; ++i) {
        Student s;
        std::cout << "Enter name and registration number: ";
        std::cin >> s.name >> s.regNumber;
        students.push_back(s);
    }

    int searchReg;
    std::cout << "Enter registration number to search: ";
    std::cin >> searchReg;
    for (const auto& student : students) {
        if (student.regNumber == searchReg) {
            std::cout << "Student found: " << student.name << std::endl;
            return 0;
        }
    }
    std::cout << "Student not found." << std::endl;
    return 0;
}

This program defines a Student structure, collects student data, and allows searching for a student by their registration number.

User Avatar

AnswerBot

2mo ago

What else can I help you with?

Related Questions

Create a HTML page to display the information of student details?

student details example by html


How do you use in?

cod a program student degree array in c language


How do you write a program to read set of numbers using by an array and display the ascending order of the given input numbers?

To write a C++ program to display the student details using class and array of object.


How do you use in array?

cod a program student degree array in c language


Where can one find information on becoming an exchange student?

One would be able to find information on becoming an exchange student from multiple sources such as senior students who have completed the exchange student program before, the teacher in charge of organising the exchange program, or from online websites that are dedicated to the exchange student program.


C plus plus program that display student name course and grade using arrays of strings?

enum field { name, course, grade }; std::string student[3]; student[name] = "Joe Bloggs"; student[course] = "C++ Programming"; student[grade] = "A+";


What is the C plus plus program to illustrate multiple inheritance for read and display student details with 3 test marks and average?

You can show multiple inheritance by inheriting student details like name ,Admission number ,Parents name, address and other information from a school class and then also inherit his marks detail from the his Class's class like Grade 3rd . You will get his marks information from there. Then go forward and make functions to calculate the average marks and display the details.


Write a c program to generate student mark details using union and find total and average and grade?

write a c program to display marks,total,average,grade using union


What is language and literature assessment?

Language and literature assessment refers to collecting information about a student's ability to use language and their knowledge of language. It is an essential part of the teaching and learning process.


What is a matriculated student?

It is a student who has declared and been accepted into a specific program of study.It is a student who has declared and been accepted into a specific program of study.It is a student who has declared and been accepted into a specific program of study.It is a student who has declared and been accepted into a specific program of study.It is a student who has declared and been accepted into a specific program of study.It is a student who has declared and been accepted into a specific program of study.


Which one of the following topics should you ask about on the Student CARE forum?

Where to find program and course information


What is an example of an appropriate email signature for a master's student?

An example of an appropriate email signature for a master's student could be: Full Name Master's Student in Program Name University Name Contact Information