C++ programming

Pages: 12
Jun 28, 2016 at 4:23pm
how will i make it display in a frequency distribution table
Jun 28, 2016 at 4:37pm
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?
Jun 28, 2016 at 4:45pm
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.
Jun 28, 2016 at 4:47pm
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

Jun 28, 2016 at 4:50pm
closed account (48T7M4Gy)
OK that makes sense, so put that together with the sample line I gave you, what is you program?
Jun 28, 2016 at 4:57pm
closed account (48T7M4Gy)
1
2
3
cout << "Category" << ... << endl;
cout << "Fail" << ... << endl;
cout << "Pass" << ...
Jun 28, 2016 at 5:02pm
i have already posted it before plz go to page 1 and see the program with the output
Jun 28, 2016 at 5:04pm
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=...
Jun 28, 2016 at 5:16pm
1
2
3
cout << "Category" << ... << endl;
cout << "Fail" << ... << endl;
cout << "Pass" << ...


when i do like this it comes expression syntax
Jun 28, 2016 at 5:19pm
closed account (48T7M4Gy)
The lines I gave you need to be completed, not just copied.
Jun 28, 2016 at 5:23pm
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();
}
Jun 28, 2016 at 5:33pm
closed account (48T7M4Gy)
So now put something in the place of each '...' like a variable name.
Jun 29, 2016 at 5:46am
thank you very much for helping me .i did it same as the way you said, it worked.
Jun 29, 2016 at 6:55am
closed account (48T7M4Gy)
Well done suresh - at last some success. :)
Topic archived. No new replies allowed.
Pages: 12