-
April 25th, 2013, 06:37 PM
#1
Vectors of class
im having a hard time trying to get this vector to work in the class. This is my second class of taking computer science and im really confuse can someone please help
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Course {
private:
int scores;
public:
Course();
Course(int s);
int minimum();
/* void print() {cout << scores; }
void countA();
void read();
int maximum();
int standard_deviation();
int average(); */
};
Course::Course()
{
scores = 0;
}
Course:: Course(int s)
{
s=scores;
}
int Course::minimum()
{
int minimum= numbers[0];
for (int i=0; i<numbers.size(); i++)
{
if (numbers[i] <minimum)
{
minimum = numbers[i];
}
}
return minimum;
}
int main()
{
Course cs202;
vector<int> numbers;
int grade;
cout<<"Enter set of scores for students until eof\n";
cin >> grade;
while (!cin.eof()) {
numbers.push_back(grade);
cin>>grade;
}
/*cs202.read();*/
cout << "Minimum = " << cs202.minimum() << endl;
/*cout << "Average = " << cs202.average() << endl;
cout << "Standard Deviation = " << cs202.standard_deviation() << endl;
cout << "Maximum = " << cs202.maximum() << endl;
cout << "A's Count = " << cs202.countA() << endl;
cout << "The scores again: \n";
cs202.print();*/
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|