joseson.cpp
资源名称:c.rar [点击查看]
上传用户:puke2000
上传日期:2022-07-25
资源大小:912k
文件大小:1k
源码类别:

C#编程

开发平台:

Visual C++

  1. //=====================================
  2. // joseson.cpp
  3. //=====================================
  4. #include"boyring.h"
  5. #include"joseson.h"
  6. #include<iostream>
  7. using namespace std;
  8. //-------------------------------------
  9. JoseSon::JoseSon(int boys, int interval, int begin, int wins)
  10.   :Jose(boys, interval, begin),w(wins){
  11.   if(w<1 || w>=n){
  12.     cout<<"failed in bad winNum.n";
  13.     throw exception();
  14.   }
  15. }//------------------------------------
  16. void JoseSon::getWinner()const{
  17.   cout<<"There are "<<n<<" boys.nBoys leaved in order:n";
  18.   BoyRing x(n);
  19.   x.countBy(s-1);
  20.   for(int i=1,numinLine=0; i<n-w+1; ++i){
  21.     x.countBy(m);
  22.     cout<<"  "<<x.getNum()<<(++numinLine%10 ? "" : "n");
  23.     x.disengage();
  24.   }
  25.   cout<<"nWinners aren";
  26.   x.printAll();
  27. }//------------------------------------
  28.