Hey guys, I've created a code that teachers can use to enter a students mark, find the average, s.d and how many occurances a certain mark has been entered.
This site has helped me a lot and i just need one final solution. I'm clueless on how to attack this question. As seen below a CMD prompt allows me to enter a students mark, find the average, the s.d and occurances. What I want to add is, instead of 6 - Find occurances for a certain mark. I would like to display all marks at once with there occurances to their right. Help ?
#include <iostream>
#include<cmath>
usingnamespace std;
//function prototypes
void readMarks(int[],int&);
void showMarks(int[],int);
void deleteMarks(int[],int&);
double Average(int[],int);
double SD(int[],int);
void countOccurences(int[],int);
void pause();
void clear();
// main function
int main()
{
int marks[20]; //to hold marks
int size=0; //for number of marks
int choise;
do
{
cout<<"\n0.Exit\n1.Add a student Marks\n2.List all student marks\n3.Average\n4.SD\n5.Delete\n6.Find Occurences"<<endl;
cout<<"\nEnter your choice-> ";
cin>>choise;
switch(choise)
{
case 1:readMarks(marks,size);break;
case 2:showMarks(marks,size);break;
case 3:cout<<endl<<Average(marks,size)<<endl;break;
case 4:cout<<endl<<SD(marks,size)<<endl;break;
case 5:deleteMarks(marks,size);break;
case 6:countOccurences(marks,size);break;
case 0:exit(0);
}
pause();
clear();}while(true);
pause();
return 0;
}
As far as my undertanding of the question...you can easily implement it by checking the array indices and storing them in some other array...
that would serve the purpose i think....