Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
5b3e223
Added header file
WarSloth21 Jan 23, 2017
d60602e
Added header file
WarSloth21 Jan 27, 2017
cb313b9
Added Student.cpp File
WarSloth21 Jan 27, 2017
f4fddbb
Added Main.cpp file
WarSloth21 Jan 27, 2017
714be53
Added header file
WarSloth21 Jan 28, 2017
c1a08bf
Added implementation file
WarSloth21 Jan 28, 2017
8cc3d79
Added client file
WarSloth21 Jan 28, 2017
128ba41
Added header file
WarSloth21 Jan 30, 2017
11e994d
Added Implementation file
WarSloth21 Jan 30, 2017
6f13c15
Added client file
WarSloth21 Jan 30, 2017
4b39924
Updated client file
WarSloth21 Feb 5, 2017
b8ec007
Updated Client file
WarSloth21 Feb 6, 2017
3db4f1e
Updated Client File
WarSloth21 Feb 6, 2017
e6cd00d
Updated Client File
WarSloth21 Feb 6, 2017
7287458
Updated Client File
WarSloth21 Feb 6, 2017
53aa65b
Updted Client File
WarSloth21 Feb 6, 2017
b8dd880
Updated Client File
WarSloth21 Feb 6, 2017
7d374f1
Updated Client File
WarSloth21 Feb 6, 2017
1280a9a
Updated Client File
WarSloth21 Feb 6, 2017
49c4f9c
Updated Client File
WarSloth21 Feb 6, 2017
05dfed5
Updated Client FIle
WarSloth21 Feb 6, 2017
71ad85b
Updated Client File
WarSloth21 Feb 6, 2017
4a55aa0
Updated Client File
WarSloth21 Feb 6, 2017
b5f9b7a
Updated Client File
WarSloth21 Feb 6, 2017
646f0cc
Updated Client File
WarSloth21 Feb 6, 2017
e641284
Updated Client File
WarSloth21 Feb 6, 2017
4150224
Updated Client File
WarSloth21 Feb 6, 2017
64a1584
Updated Client File
WarSloth21 Feb 6, 2017
5e0c588
Updated Client FIle
WarSloth21 Feb 6, 2017
acc5c32
Updated Client File
WarSloth21 Feb 6, 2017
88563bd
Updated Client File
WarSloth21 Feb 6, 2017
2858b13
Updted Client FIle
WarSloth21 Feb 6, 2017
fd3f5e1
Updated Client FIle
WarSloth21 Feb 6, 2017
0d33198
Updated Client File
WarSloth21 Feb 13, 2017
c5b2f1d
Updated Client File
WarSloth21 Feb 13, 2017
6a1878e
Updated Client File
WarSloth21 Feb 13, 2017
9cd7430
Updated Client File
WarSloth21 Feb 13, 2017
4b2e8bf
Updated Client File
WarSloth21 Feb 13, 2017
b933316
Updated Client File
WarSloth21 Feb 13, 2017
bf5daa0
Updated Client File
WarSloth21 Feb 13, 2017
00cc395
Updated Client File
WarSloth21 Feb 13, 2017
813fceb
Updated Client File
WarSloth21 Feb 13, 2017
f0ebfae
Updated Client File
WarSloth21 Feb 13, 2017
2025e5f
Updated Client FIle
WarSloth21 Feb 13, 2017
91e4a6c
Updated Client File
WarSloth21 Feb 13, 2017
31445a6
Updated Client File
WarSloth21 Feb 13, 2017
7a8a3ee
Updated Client FIle
WarSloth21 Feb 13, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions Main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#include <iostream>
#include <string>
#include <vector>
#include "Student.h"

using namespace std;

void fillVector(vector<Student> newClass) ;
void printVector(const vector<Student> newClass);
int linearSearch(vector<Student> newClass, string name);

int main() {



string result;
string key;
string name;
char choice;
vector<Student> myclass;

fillVector(myclass);
printVector(myclass);

cout << "Would you like to search for a student? y = yes , n = no" << endl;
cin >> choice;



while(choice == 'y')
{
cout << "Please enter the name of the student you would like to search" << endl;
cin >> name;

result = linearSearch(myclass, name);
cout << " " << name << "was ";
if ( result == name )
cout << " found";
else
cout << " not found" << result;

cout << "Would you like to search for a student? y = yes , n = no" << endl;
cin >> choice;
}

return 0;

}

int linearSearch(vector<Student> newClass, string name)
{

for(int i = 0; i < newClass.size(); i ++)
{
if ( newClass[i].getName() == name )//we found it
{
return i;//return its location
}
}//end for
return -1;//element not found
}


void fillVector(vector<Student> newClass) {

string name;
char grade;

cout << "Please enter the amount of students in class? " << endl;
int numStudents;
cin >> numStudents;

for (int i = 0; i < numStudents; i++) {
cout << "Please enter Student's Name: ";
cin >> name;
cout << "Please enter Student's Grade: ";
cin >> grade;

Student newStudent(name, grade);
newClass.push_back(newStudent);
cout << endl;
}
cout << endl;

}

void printVector(const vector<Student> newClass) {
for (unsigned int i = 0; i < newClass.size(); i++) {
cout << "Student Name: " << newClass[i].getName() << endl;
cout << "Student Grade: " << newClass[i].getGrade() << endl;
cout << endl;

}
}
32 changes: 32 additions & 0 deletions Student.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <vector>
#include "Student.h"


Student::Student() {
newGrade = ' ';
}

Student::Student(string name, char grade) {
newName = name;
newGrade = grade;
}

string Student::getName() const {
return newName;
}

char Student::getGrade() const {
return newGrade;
}

void Student::setName(string name) {
newName = name;
}

void Student::setGrade(char grade) {
newGrade = grade;
}




25 changes: 25 additions & 0 deletions Student.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef STUDENT_H
#define STUDENT_H

#include <iostream>
#include <string>
using namespace std;

class Student {
private:
string newName;
char newGrade;

public:
Student();

Student(string, char);

string getName() const;
char getGrade() const;

void setName (string);
void setGrade(char);
};
#endif // !STUDENT_H