#include <iostream> // includes cin cout
#include <cmath> // includes math function pow sqrt ect.
#include<iomanip> // includes setw set precision
#include <stdlib.h> // includes rand
#include <ctime> // includes time
// setting up the environment
usingnamespace std;
constint numberOfStudents = 200;
struct StudentsInfo {
int id_number;
int score;
};
class Course
{
public:
void setSudentsClass (int allOfStudents[])
{
studentsClass[numberOfStudents] = allOfStudents[numberOfStudents];
}
int getStudentsClass()
{
return studentsClass[numberOfStudents];
}
private:
int studentsClass[numberOfStudents];
};
int main ()
{
Course HeyWorld;
HeyWorld.setSudentsClass( /* What can i put here ?*/ );
// this is where I geT the ERROR
// what can i put in the parameters to acces the array in my class?
cout << getStudentClass();
}
void selectionSort(int a[ ], int n)
{
int i, k, indexOfNextSmallest, temp;
for (i = 0; i < n - 1; i++)
{
indexOfNextSmallest = i;
for (k=i+1; k<n; k++)
if (a[k] < a[indexOfNextSmallest])
indexOfNextSmallest = k;
temp = a[i];
a[i] = a[indexOfNextSmallest];
a[indexOfNextSmallest] = temp;
}
}
int Score(int allStudents[numberOfStudents] )
{
/* Here I dont know if i did this right but i want to give the array
in my class to set the value equal to the structure so that each student
has two variables to them . The students are given a random id number
thats from 1 - 500 and a score that is 1 - 100. Can some one tell me
if i did this righ and how would i put this function in my class? */
srand(time(NULL));
for (int i = 0;i < numberOfStudents; ++i )
{
Course StudentsTakingCourse;
StudentsInfo InfomationForStudents;
InfomationForStudents.id_number = rand()%500 + 1;
InfomationForStudents.score = rand()%100 + 1;
StudentsTakingCourse.studentsClass[i] = InfomationForStudents.id_number;
StudentsTakingCourse.studentsClass[i] = InfomationForStudents.score;
}
}