c++概率的运用,基于控制台程序(二)

2014-02-14 12:52:22 · 作者: · 浏览: 327

 

  cout 《 "打平了!" 《 "****************……你的胜率:" 《 rate 《 "%" 《 endl;

  }

  if ((com == 1) && (you == 2))

  {

  cout 《 "你赢了!****" 《 "电脑>>>石头****你>>>布" 《 "……你的胜率:" 《 rate 《 "%" 《 endl;

  Count_you++;

  }

  if ((com == 1) && (you == 3))

  {

  cout 《 "你输了!****" 《 "电脑>>>石头****你>>>剪刀" 《 "……你的胜率:" 《 rate 《 "%" 《 endl;

  Count_com++;

  }

  if ((com == 2) && (you == 1))

  {

  cout 《 "你输了!****" 《 "电脑>>>布  ****你>>>石头" 《 "……你的胜率:" 《 rate 《 "%" 《 endl;

  Count_com++;

  }

  if ((com == 2) && (you == 3))

  {

  cout 《 "你赢了!****" 《 "电脑>>>布  ****你>>>剪刀" 《 "……你的胜率:" 《 rate 《 "%" 《 endl;

  Count_you++;

  }

  if ((com == 3) && (you == 1))

  {

  cout 《 "你赢了!****" 《 "电脑>>>剪刀****你>>>石头" 《 "……你的胜率:" 《 rate 《 "%" 《 endl;

  Count_you++;

  }

  if ((com == 3) && (you == 2))

  {

  cout 《 "你输了!****" 《 "电脑>>>剪刀****你>>>布 " 《 "……你的胜率:" 《 rate 《 "%" 《 endl;

  Count_com++;

  }

  }

  /////////////主函数//////////////////////

  int main()

  {

  int choice=0;

  again:  cout 《 "________________________概率测试_____________________" 《 endl;

  cout 《 "1.石头剪刀布。" 《 endl;

  cout 《 "2.抛硬币。" 《 endl;

  cout 《 "3.π的计算。" 《 endl;

  cout 《 "_____________________________________________________" 《 endl;

  cin 》 choice;

  switch (choice)

  {

  case 1:start1();

  case 2:start2();

  case 3:start3();

  [cpp] view plaincopy在CODE上查看代码片派生到我的代码片

  default:goto again;

  }

  system("pause");