Below I have provided my current code. The 4th image is the result that I am trying to get. I would like to get some hel

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Below I have provided my current code. The 4th image is the result that I am trying to get. I would like to get some hel

Post by answerhappygod »

Below I have provided my current code.
The 4th image is the result that I am trying to get. I would
like to get some help in the int main() section of my
code.
I don't really know how to call my function prototypes. Thank
you in advance.
Below I Have Provided My Current Code The 4th Image Is The Result That I Am Trying To Get I Would Like To Get Some Hel 1
Below I Have Provided My Current Code The 4th Image Is The Result That I Am Trying To Get I Would Like To Get Some Hel 1 (49.88 KiB) Viewed 32 times
Below I Have Provided My Current Code The 4th Image Is The Result That I Am Trying To Get I Would Like To Get Some Hel 2
Below I Have Provided My Current Code The 4th Image Is The Result That I Am Trying To Get I Would Like To Get Some Hel 2 (40.11 KiB) Viewed 32 times
Below I Have Provided My Current Code The 4th Image Is The Result That I Am Trying To Get I Would Like To Get Some Hel 3
Below I Have Provided My Current Code The 4th Image Is The Result That I Am Trying To Get I Would Like To Get Some Hel 3 (32.33 KiB) Viewed 32 times
Below I Have Provided My Current Code The 4th Image Is The Result That I Am Trying To Get I Would Like To Get Some Hel 4
Below I Have Provided My Current Code The 4th Image Is The Result That I Am Trying To Get I Would Like To Get Some Hel 4 (190.97 KiB) Viewed 32 times
#include <iomanip> #include <iostream> #include <string> #include <cstdlib> using namespace std; class student { public: student(); student(string id, string name, int crds, double GPA); string getSname(); void setSname(string sname); void inputValuesForOneStuObjO; void displayOneStuObj(); bool compareNames(student s2); int fillSturecs(student s[], int capacity); void displaySturecs(student s[], int n); void sortStuRecsByName(student s[], int n); int linearSearchForName(student s[], int n; string key); int binarySearchForName(student s[], int n; string key); private: string sid; string sname; int credits; double gpa; }; /// /// /// int main() { WIT/Not Sure how to call the fillstukese student s[], int capacity); return 0; }

student::student() { sid = "No ID": sname = "No Name" : credits = m; gpa = 2.0: } student::student(string id, string name, int srds, double GPA) { sid = id; sname = name: credits = crds: gpa = GPA: } string student::getSname() { return sname: } void student::setsname(string name) { sname } void student::inputValuesForOneStuobj() { cin >> sid >> sname >> credits >> gpa; } void student::displayOneStuobj() { cout <<" "<< sid <<" "<< sname << " " << credits<< "" <gpa<<"\n"; } = name bool students compareNames (student s2) { if (sname > 52.sname) return true; else return false; } int student:fillsturecs(student s[], int capacity) { cout << "You can enter up to " << capacity << "student records, How many? "; cin >> ni cout << "Enter the following student info. sid, name, credits, gpa: "; for (int i = 0; i<n; i++) { s[ilinputValuesForOneStuobj(); int n; return n; } }

Joid student::displaySturecs(student s[], int n) { for (int i = 0; i<n; i++) { cout << sid << sname < credits « gpa; s[il.displayOneStuobj(); } } void student::sortSturecsByName(student s[], int n) { student temp: for (int i = 0; i<n - 1; ++i) { for (int j = i + 1; j<n; ++i) { if (s.sname.compare (s[j].sn snane) > 0) { temp = 5 s; s s[jl: s[j] temp: } } } int student: linear SearchForName(student s[], int n, string key) { int pos = -1; for (int i = 0; i < n; i++) { if (s[il.getSname() = key) { pos = i; return pos; } } } } int student::binary SearchForName(student s[], int n, string key) { int low = @, high = n - 1, mid; while (Low <= high) { mid = (Low + high) / 2: if (s[mid) .sid key) return mid; else if (s[mid). sid > key) high = nid - 1; else Low = mid + 1; } return -1; }

X Select Microsoft Visual Studio Debug Console You may enter up to 10 student records. How many? 3 Enter values for a student record in the order of: sid, sname, credits, and gps : --> Student [1]: Enter sid, name, credits completed, and gpa for the student: S1111 John 33 3.33 --> Student (2]: Enter sid, name, credits completed, and gpa for the student: S2222 Anna 44 3.44 --> Student (3]: Enter sid, name, credits completed, and gpa for the student: 53333 Alex 55 3.55 *** Student Progress Report *** SID NAME CREDITS GPA s1111 S2222 S3333 John Anna Alex 33 44 55 3.33 3.44 3.55 Testing linear Search(...) function: Enter sname for a student to be searched --> Alex "Alex"is found in sname[2]. Testing binarySearch(...) function: The student array must be sorted by sname. So we perform the sort operation first. Performing sort ... After soringing student records by name in alphabetical order: *** Student Progress Report *** SID NAME CREDITS GPA 55 S3333 s2222 s1111 Alex Anna John 44 33 3.55 3.44 3.33 Enter sname for a student to be searched --> John "John"is found in sname[2].
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply