题目
帮忙写个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啊~~~谢谢
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啊~~~谢谢
提问时间:2021-03-04
答案
#include
#include
using namespace std;
int f();
int main()
{
srand((unsigned)time(0));
int heads=0,tails=0;
for(int i=0;i
#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的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
- 1三个自然数的乘积为84,其中两个数的和正好等于第三个数,请求出这三个数.
- 2在Rt三角形ABC中∠C=90度,b=6,c=8,解这个直角三角形
- 3非弹性形变的物体有没有支持力
- 4语文类的题
- 5To my surprise,the young girl laughs in the way -----her mother did at that age .
- 6家用电器功率上限5000瓦用多少安培电表?线径应该用多大的?
- 7美国的research fellow,research investigator分别是指什么?
- 8show speed spell 的过去式和过去分词各是什么
- 9分析下每个选项 思路.·
- 10某种商品进价250元,按标价的九折销售时,利润率为15.2%,则这种商品每件标价是 _.
热门考点
- 1英语的第一人称,第二一下人称,第三人称,单三人称是怎么回事,
- 2一个饭店除了按营业额的百分之五缴纳营业税外,还要按营业额的百分之七缴纳城市维护建
- 3设在部分球面x²+y²+z²=5R²,x>0,y>0,z>0上函数f(x,y,z)=lnx+lny+3lnz有极大值
- 42006年9月1日是星期五,你能算出这个月上多少天课?休息多少天?要算式!
- 5一个同余性质的证明
- 6甲乙两人用去的总张数小于剩下的总张数的一半,若甲只用了5张,则乙最多用了多少张?
- 7一个分数是24分之15,如果分母减少16,要使分数大小不变,分子因减少多少?
- 8温度计的水银蒸发需要多久
- 9一个减法算式中,被减数是178,被减数,减数,差的和是多少?
- 10我国有一座世界上最大的石刻弥勒佛坐像-----四川乐山大佛.这句话中的破折号代表怎样的用法?你能试着造一句吗?