Question
Urgent plssss the code given: int menu(Student &student) { int option; cout > option; return option; } void getLoginInfo(string &stdId, string &stdpass) { cout >
Urgent plssss
the code given:
int menu(Student &student) { int option; cout > option; return option; } void getLoginInfo(string &stdId, string &stdpass) { cout > stdId; cout > stdpass; } Fill in the blanks on the following provide main function. int main() { ifstream incoursefile("courses.txt"); ifstream instudentfile("student.txt"); string stdId, stdpass, ccode; int numcourses, numstud; incoursefile >> numcourses; instudentfile >> numstud; Student* studArr = new Student[numstud]; Course* courseArr = new Course[numcourses]; readCourses(incoursefile, courseArr); readStudents(instudentfile, studArr); getLoginInfo(stdId, stdpass); int foundStudIndx = searchStudent(studArr, stdId, stdpass, numstud); int option=0; int foundCourseInd; do { int option = menu(studArr[foundStudIndx]); switch (option) { case 1: cout > ccode; foundCourseInd = searchCourse(courseArr, ccode, numcourses); 4 //write the code to register a student to the selected course if exists //_____________________________________________________________ break; case 2: //write the code to display all courses registered for the student by //calling the implemented function //_____________________________________________________________ break; case 3: //write the code to display all available courses for registration by //calling the implemented function. //_____________________________________________________________ break; case 4: cout > ccode; //write the code to delete a course if the student is registered in it. //if the student is not in the registered in the course, display you //are not registered in this course //_____________________________________________________________ break; default: cout Overview: In this homework, you will use structures. You will create a program that allows students to register for not more than 6 courses. You will develop: structure for student that includes the student's full name, ID, password, phone number, number of registered courses, and a vector that holds the registered courses of type course. Structure for course that that includes the course code, course name, and instructor name. Function Definition Requirements: You are required to implement the following functions based on the provided requirements below. void registercourse(Student& student, Course& course) - This function takes in a student object and a course object. The function shall check if the student already registered for 6 courses. if so, the function shall print a message saying that you are not allowed to register for any additional courses o if not, the function adds a course into the student registered course vector and increment the number of registered courses for the student. void readCourses(ifstrean &incoursefile, Course + courseArr) - This function takes in the input file stream object for the open course.txt file, and the pointer to the course array. The function reads the course information from the provided sample course.txt file The text file has the following format: The first value contains the number of courses in the file o The next line contains the course code o The next line contains the course name The next line contains the instructor name The lines forward are repeats with the same information for each course 4 CMP120 Programming 1 Dr. Raafat Aburukba COE 371 Networking Dr. Ejaz Rana Ahmad CMP 228 Programming 2 Dr. Raafat Aburukba CMP 484 Cloud Computing Dr. Raafat Aburukba 1 1 void readStudents(ifstrean& inStudfile, Student studArr) This function takes in the input file stream object for the open file student.txt, and the pointer to the student array. The function reads the student information from the provided sample student.txt file The student.txt file has the following format: The first value contains the number of students in the file The next line contains the student id o The next line contains the password The next line contains the student name o The lines forward are repeats with the same information for each student 2 be21466 password Raafat Aburukba ge111 pizza Marian Smith int searchStudent(Student studArr, string sid, string pass, int numstud) - This function takes in a pointer to the student array, a string to the student id, a string contains the password, and the number of students in the student array The function should search the array for the student with the same student id and password and returns the index of where the student is found in the array If the student id and password are the not found in the array, the function returns -1 int searchCourse(Course courseArr, string code, int nuncourse) - This function takes in a pointer to the course array, a string to the course code, and the number of courses in the course array - The function should search the array for the course with the same course code and returns the index of where the course is found in the array If the course code code is not found in the array, the function returns -1 void dispregCourses (Student student) This function displays the student's name and all courses that the student is registered in. The following functions are created, and you need to use them as is without modifications. int menu(Student &student) { int option; cout > option; return option; } void getLogin Info(string &stdid, string &stdpass) 1 cout > stdId; cout > stdpass; } Fill in the blanks on the following provide main function. int main() 1 ifstrean incoursefile("courses.txt"); ifstream instudentfile("student.txt"); string stdid, stdpass, ccode; int numcourses, numstud; incoursefile >> nuncourses; instudentfile >> nunstud; Student studArr = new Student[numstud); Course" courseArr - new Course [nuncourses); read Courses (incoursefile, courseArr); readStudents(instudentfile, studArr); getLoginInfo(stdid, stdpass); int foundStudIndx - searchStudent (studArr, stdid, stdpass, numstud); int option-@; int foundCourseInd; da { int option - menu(studArr[foundStudIndx]); switch (option) { case 1: cout > ccade; foundCourseInd- searchCourse(courseArr, ccode, numcourses); 3 //write the code to register a student to the selected course if exists break; case 2: // write the code to display all courses registered for the student by // calling the implemented function 1/ break; case 3: 1/write the code to display all available courses for registration by //calling the implemented function. 17 break; case 4: cout > ccade; //write the code to delete a course if the student is registered in it. //if the student is not in the registered in the course, display "you 1/are not registered in this course" 11 break; default: cout
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