poj 2070 Filling Out the Team

来源:互联网 发布:caffe怎么读 编辑:程序博客网 时间:2024/05/21 14:00
#include "iostream"#include "string"using namespace std;struct Info{   string pos;   double speed;   int weight;   int strength;};int main(){    bool flag;    double sp;    int w, s, i;    Info info[3];    info[0].pos = "Wide Receiver", info[0].speed = 4.5, info[0].weight = 150, info[0].strength = 200;    info[1].pos = "Lineman", info[1].speed = 6.0, info[1].weight = 300, info[1].strength = 500;    info[2].pos = "Quarterback", info[2].speed = 5.0, info[2].weight = 200, info[2].strength = 300;    while (cin >> sp >> w >> s)    {          flag = false;          if (sp ==0 && w == 0 && s == 0)  break;          for (i = 0; i < 3; i++)          {              if (info[i].speed >= sp && info[i].weight <= w && info[i].strength <= s)              {                 if (flag)                    cout << " ";                 cout << info[i].pos;                 flag = true;              }          }          if (!flag)             cout << "No positions" << endl;          else              cout << endl;    }        system("pause");}

原创粉丝点击