为什么只显示第一个函数?
#include<iostream>using namespace std;
class Customers
{
float amounts[10];
public:
void sortData()
{
int ctr;
for (ctr=0; ctr<10; ctr++)
{
cout<<"enter the amount:";
cin>>amounts[ctr];
}
int counter=0;
while(counter<9)
{
float temp;
if(amounts[counter]>amounts[counter+1])
{
temp=amounts[counter];
amounts[counter]=amounts[counter+1];
amounts[counter+1]=temp;
counter=0;
continue;
}
counter++;
}
}
void display()
{
for(int counter=0;counter<10;++counter)
{
cout<<"element"<<counter<<": "<<amounts[counter] <<endl;
}
}
};
int main()
{
Customers C1;
C1.sortData();
C1.display();
return 0;
}
为什么我输入10个数字以后,窗口马上就消失了?void display()里的不会显示出来?