帮忙写个C++的Code,是英语题.

帮忙写个C++的Code,是英语题.
Write a program that simulates coin tossing. For each toss of the coin, the program should print Heads or Tails. Let the program toss the coin 100 times and count the numberof times each side of the coin appears. Print the results. The program should call a separate function flip that takes no arguments and returns 0 for tails and 1 for heads. [Note: If the program realistically simulates the coin tossing, then each side of the coin should appear approximately half the time.]
写一个程序,模拟掷硬币.对于每一个硬币的折腾,程序应该打印头或尾.让程序抛硬币100次计数numberof次出现每个硬币的一面.打印结果.该程序应调用不带任何参数,并返回0的尾巴和1头一个单独的函数翻转. [注意:如果该程序切实模拟掷硬币,那么每个硬币的一面应出现约一半的时间.

这个是工具翻译的,大概这个意思,高手帮忙写个code啊~~~谢谢
其他人气:690 ℃时间:2020-05-21 21:09:42
优质解答
#include
#include
using namespace std;
int f();
int main()
{
srand((unsigned)time(0));
int heads=0,tails=0;
for(int i=0;i
我来回答
类似推荐
请使用1024x768 IE6.0或更高版本浏览器浏览本站点,以保证最佳阅读效果。本页提供作业小助手,一起搜作业以及作业好帮手最新版!
版权所有 CopyRight © 2012-2024 作业小助手 All Rights Reserved. 手机版