帮忙写个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啊~~~谢谢
答案
#include
#include
using namespace std;
int f();
int main()
{
srand((unsigned)time(0));
int heads=0,tails=0;
for(int i=0;i
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
最新试题
- KMnO4KIH2SO4→MnSO4I2KIO3K2SO4H2O (1) 该反应
- n个三角形最多把平面分成几块区域,递推公式怎么弄出来的?
- 求一个C语言运算,输入3位整数,个位,十位,百位,数字之和的运算,
- 求一篇读后感和意见令我感动的事作文
- 数学大神现身吧!已知a,bc,分别为三角形ABC的三个内角ABC的对边,cosA/cosC=a/2b-c求A的值.当a=✔3时,b∧2+c∧2的取值范围.
- 抛物线y2=12x上与焦点的距离等于9的点的横坐标是_.
- 什么是光谱?如何进行光谱检测确定元素?
- 高手来划分英语句子成分并翻译
- 你说的我都记得 翻译成英文
- 1.智而用私不如愚而用公.2.冠虽故必加于首.3.履虽新必关于足.三句中需要断句吗?
热门考点