Question
#include #include Student.h using namespace std; int main() { Student* students = nullptr; Student obj; int numStudents = 0; bool done = false; while (!done)
#include
int main() { Student* students = nullptr; Student obj; int numStudents = 0;
bool done = false; while (!done) { std::cout > choice;
switch (choice) { case 1: obj.addStudent(students, numStudents); break; case 2: obj.searchForStudent(students, numStudents); break; case 3: obj.showListOfStudents(students, numStudents); break; case 4: done = true; break; default: cout
} }
delete[] students; return 0; }
________
#include
using namespace std;
Student::Student() { const int temp = 200; street = new char[temp]; city = new char[temp]; state = new char[temp]; studentName = new char[temp]; id = 0; }
Student::~Student() { delete[] street; delete[] city; delete[] state; delete[] studentName; }
void Student::addStudent(Student*& students, int& numStudents) { system("CLS"); Student* newStudents = new Student[numStudents + 1];
for (int i = 0; i
cout > newStudents[numStudents].studentName; cout > newStudents[numStudents].street; cout > newStudents[numStudents].city; cout > newStudents[numStudents].state; cout > newStudents[numStudents].id;
numStudents++; delete[] students; students = newStudents; }
void Student::searchForStudent(Student* students, int numStudents) { system("CLS"); std::cout > name;
for (int i = 0; i
std::cout
void Student::showListOfStudents(Student* students, int numStudents) { system("CLS"); cout
________ #include
const int temp = 200;
class Student {
private: char* street; char* city; char* state; char* studentName; long id;
public:
Student();
~Student(); void addStudent(Student*& students, int& numStudents); void searchForStudent(Student* students, int numStudents); void showListOfStudents(Student* students, int numStudents); };
My show student list keeps showing up like, would appreciate if someone could show me what I did wrong. c++
Sergio (154362) Menu: 1. Add student 2. Search for student 2. Search for student 4. Exit
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started