Looping Problem

I need to write a program that manipulates the list of players in different teams.
I'm not allowed to use arrays.

A: adds a new player
I: shows details about a team
P: prints a statistical report
X: quits program

The code I wrote works fine, but I'm having 1 issue:

Function printStat() in line 165 is supposed to show the number of players in each team, but when I run it, it doesn't show anything.

I don't know what the problem is.
1
2
3
4
5
6

	void printStat(char chosenteamCode, int count )
{
	if (count>0)
		cout <<  setw(10) << chosenteamCode << " " << setw(10) <<count << endl;
}


This is the list of players:

Jack Smith 24 A
Justin Harris 20 A
Robert Gossard 26 B
John Anderson 18 K
James Lewis 19 H
Paul Williams 30 A
Last edited on
What are you trying to accomplish with the printing?
e.g. why are you using this

for(letter = 'A'; letter <= 'Z'; letter++)

for a loop? Are you trying reprint in alphabetical order?
I'm trying to show the number of players in each team with the team code, is there any other way I can do it without arrays?

Like this:

A 3
B 1
K 1
H 1
I updated the code. It now shows this


Team code             #ofPlayers

A                                 3


with the A team only
Last edited on
Topic archived. No new replies allowed.