注册 登录
编程论坛 C++教室

为什么只显示第一个函数?

niitp 发布于 2007-12-05 20:01, 1093 次点击
#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()里的不会显示出来?
7 回复
#2
aipb20072007-12-05 23:14
没有问题
#3
niitp2007-12-06 00:38
我知道没问题..

可是为什么我输入10个数字以后,窗口马上就消失了?void display()里的不会显示出来?
#4
独狐箭2007-12-06 13:35
不是那种结果
你说的 输入10个数字以后,窗口马上就消失了?void display()里的不会显示出来?   的情况在我机器上没出现啊,好好的
#5
niitp2007-12-06 14:49
我郁闷,为什么我这里就这样...555
#6
dubaoshi2007-12-07 10:31
是和编程器有关的,有的需要在程序最后加1个或2个getch()
#7
独狐箭2007-12-07 13:06
你的是哪种编译器,什么系统??
#8
孤魂居士2007-12-09 12:18
怎么还加2个getch? 不会有错?
1