C++ programming

Pages: 12
how will i make it display in a frequency distribution table
Please explain "a frequency distribution table". Is it a small round wooden table at the office, where customers queue to to collect their frequencies from?
closed account (48T7M4Gy)
OK suresh you have some choices to make. Do you go and buy some wood and tools or do you want to save your money and think about what the table might look like and then tell us?

We are very lazy so you have to do all the work. So far you are doing well.
no its not it means this:
Category frequency
Fail ........... //no. of students who have failed
Pass ........... //no. of students who have passed
Good ............. //no. of students who have good marks
Very Good ............ //no. of students who have very good marks
excellent ............ //no. of students who have excellent marks

this is a frequency distribution table

the whole output of the program should look like this:
Enter number of students

Enter the marks of students

Category	frequency
Fail	         ...........    //no. of students who have failed
Pass	        ...........     //no. of students who have passed
Good	        .............   //no. of students who have good marks
Very Good	 ............   //no. of students who have very good marks
excellent    ............   //no. of students who have excellent marks

closed account (48T7M4Gy)
OK that makes sense, so put that together with the sample line I gave you, what is you program?
closed account (48T7M4Gy)
1
2
3
cout << "Category" << ... << endl;
cout << "Fail" << ... << endl;
cout << "Pass" << ...
i have already posted it before plz go to page 1 and see the program with the output
Now the program looks like this;
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
#include<iostream.h>
#include<conio.h>
int main()
{
int marks[50], n;
cout<<"Enter number of students";
cin>>n;
int fail=0, pass=0, good=0, verygood=0, excellent=0;
for(int i=0;i<n;i++)
{
cout<<"Enter the marks of students";
cin>>marks[i];
if ((marks[i]>=0) && (marks[i]<=34))
fail++;
else if ((marks[i]>=36) && (marks[i]<=59))
pass++;
else if ((marks[i]>=60) && (marks[i]<=79))
good++;
else if ((marks[i]>=80) && (marks[i]<=89))
verygood++;
else if (marks[i]>=90)
excellent++;
}
cout<<"fail="<<fail<<"\t"<<"pass="<<pass<<"\t"<<"good="<<good<<"\t"<<"verygood="<<verygood<<"\t"<<"excellent="<<excellent;
getch();
}




Enter number of students

enter the marks of students

fail=...   pass=...  good=.... verygood=...  excellent=...
1
2
3
cout << "Category" << ... << endl;
cout << "Fail" << ... << endl;
cout << "Pass" << ...


when i do like this it comes expression syntax
closed account (48T7M4Gy)
The lines I gave you need to be completed, not just copied.
i did that
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
 #include<iostream.h>
#include<conio.h>
int main()
{
int marks[50], n;
cout<<"Enter number of students";
cin>>n;
int fail=0, pass=0, good=0, verygood=0, excellent=0;
for(int i=0;i<n;i++)
{
cout<<"Enter the marks of students";
cin>>marks[i];
if ((marks[i]>=0) && (marks[i]<=34))
fail++;
else if ((marks[i]>=36) && (marks[i]<=59))
pass++;
else if ((marks[i]>=60) && (marks[i]<=79))
good++;
else if ((marks[i]>=80) && (marks[i]<=89))
verygood++;
else if (marks[i]>=90)
excellent++;
}
cout << "Category" << '...' << endl;
cout << "Fail" << '...' << endl;
cout << "Pass" << '...' << endl;
cout << "Good" << '...' << endl;
cout << "Very good" << '...' << endl;
cout << "Execellent" << '...' << endl;
getch();
}
closed account (48T7M4Gy)
So now put something in the place of each '...' like a variable name.
thank you very much for helping me .i did it same as the way you said, it worked.
closed account (48T7M4Gy)
Well done suresh - at last some success. :)
Topic archived. No new replies allowed.
Pages: 12