How to display all marks and there occurances

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 ?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <iostream>
#include<cmath>
using namespace 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....
Topic archived. No new replies allowed.