good day everyone there's something i've been trying to do in c++
its a program that finds the mean median and mode from a group
set of data, it should use vectors to read these data from the user
and then tabulate into:
grade distribution
class mark(x)
fx
i've tried to the best of my knowledge, but here's what i could
get in the moment. please i'll be most greatful to anyone who'll help
#ifndef GRADEBOOK_H
#define GRADEBOOK_H
#include<iostream>
using namespace std;
#include<string>
using std::string;
#include<vector>
using std::vector;
class GradeBook
{
public:
GradeBook(string, vector<int> & );
string getCourseName();
void run();
void displaycoursename(vector<int> &);
void processgrade();
int getmaximum();
int getminimum();
private:
string coursename;
vector<int>score;
void accessvector();
};
#endif
#include <iostream>
using namespace std;
#include<iomanip>
using std::setw;
#include <vector>
using std::vector;
#include "GradeBook.h"
GradeBook::GradeBook(string name, vector<int> & result)
{
coursename = name;
score = result;
}
string GradeBook::getCourseName()
{
return coursename;
}
void GradeBook::run()
{
displaycoursename(score);
}
void GradeBook::displaycoursename(vector<int> & osagie)
{
cout << "\nyou have entered:" << endl;
for(size_t i=0; i<osagie.size(); i++)
cout <<"\n" <<osagie[i];
cout << "\n " << "SOLUTION\n" << endl;
cout << "mark(x)" << " " <<"frequency(f)"<<" "<<"fx\n\n";
for(size_t i=0; i<osagie.size(); i++)
cout << setw(3) << osagie[i] << "\n";
cout << endl;
}
#include <iostream>
using namespace std;
#include<vector>
using std::vector;
#include "GradeBook.h"
void collectdata(vector<int> &);
void main()
{
vector<int>grade;
collectdata(grade);
GradeBook mean( "a program that finds the mean median and mode of data", grade );
mean.run();
}
void collectdata(vector<int> & mark)
{
int values;
cout << "Enter statistical values to analyse\n"
<< "when through press ctrl+Z\n\n\n";
while(cin>>values){
mark.push_back(values);
}
}