исправил. А вообще зачем в списке дублируются исполнители с одинаковыми именами ? Может лучше input_new исправить ?
C++ |
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
| #include <list>
//
void rating_display(record_library* begin)
{
std::list<char const*> lst;
record_library* current=begin;
int w=8;
cout<<"Rating of Musicians:"<<endl;
cout<<setw(w)<<"Name"<<setw(w)<<"Albums"<<endl;
while (current!=NULL)
{
int albumcount=0;
bool found = false;
for(std::list<char const*>::const_iterator cib(lst.begin()); cib != lst.end(); ++cib)
{
//std::cout << *cib << "\n";
if(!strcmp(*cib, current->name))
{
//std::cout << "\nfound: " << current->name << "\n\n";
found = true;
break;
}
}
if(!found)
{
lst.push_back(current->name);
CalcStatist(current,current->name, albumcount);
cout<<setw(w)<<current->name<<setw(w)<<albumcount<<endl;
}
current=current->next;
}
wait_key();
} |
|