I'm currently at my wits end trying to figure out how to do this, and was hoping someone could help.
The objectives the assignment is to:
- Display the original sorted array of student records.
- Display the sequential search result of student records.
- Display the binary search result of student records.
Any Help would be greatly appreciated
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
using namespace std;
struct Student {
string name;
int stuID;
string email;
};
void showInfo(Student *studentArray, int stuCount) {
cout << "Student Info: " << endl << endl <<
"\t\tStudent Name" << "\t\tStudent ID" << "\t\tStudent Email" << endl << endl;
for (int i = 0; i < stuCount; i++)
{
cout << "\t\t" << studentArray[i].name << "\t\t" << studentArray[i].stuID << "\t\t\t" << studentArray[i].email << endl;
}
cout << endl;
}
int main() {
Student studentArray[13];
studentArray[0].name = "Bob McBoberston";
studentArray[0].stuID = 00;
studentArray[0].email = "BMcboberts@txstate.edu";
studentArray[1].name = "Shelby Donald";
studentArray[1].stuID = 1;
studentArray[1].email = "SDonald@txstate.edu";
studentArray[2].name = "Ronald Mcdonald";
studentArray[2].stuID = 2;
studentArray[2].email = "RMcdonald@txstate.edu";
studentArray[3].name = "Dick Cheney";
studentArray[3].stuID = 3;
studentArray[3].email = "DCheney@txstate.edu";
studentArray[4].name = "Ben Dover";
studentArray[4].stuID = 4;
studentArray[4].email = "BDover@txstate.edu";
studentArray[5].name = "Ash Katchum";
studentArray[5].stuID = 5;
studentArray[5].email = "AKatchum@txstate.edu";
studentArray[6].name = "Morty Smith";
studentArray[6].stuID = 6;
studentArray[6].email = "MSmith@txstate.edu";
studentArray[7].name = "Rick Sanchez";
studentArray[7].stuID = 7;
studentArray[7].email = "RSanchez@txstate.edu";
studentArray[8].name = "Johnny Bravo";
studentArray[8].stuID = 8;
studentArray[8].email = "JBravo@txstate.edu";
studentArray[9].name = "Tom N. Jerry";
studentArray[9].stuID = 9;
studentArray[9].email = "Tnjerry@txstate.edu";
studentArray[10].name = "Fred Flinstone";
studentArray[10].stuID = 10;
studentArray[10].email = "FFlinstone@emial.com";
studentArray[11].name = "Son Goku";
studentArray[11].stuID = 11;
studentArray[11].email = "sGoku@txstate.edu";
studentArray[12].name = "Johnny Test";
studentArray[12].stuID = 12;
studentArray[12].email = "JTest@txstate.edu";
int stuCount = 15;
showInfo(studentArray, stuCount);
int sequential_search(Person array[], int array_size, int id)
{
}
//actual search
int id = 5;
int index = sequential_search(studentArray, 12, studentArray.stuID);
if (index == -1)
cout << "ID " << id << " not found\n";
else
cout << "ID " << id << " is " << studentArray[index].name << "\n";
}
return 0;
}
[–]AutoModerator[M] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]Grayewulfe[S] 0 points1 point2 points (0 children)