精品偷拍一区二区三区,亚洲精品永久 码,亚洲综合日韩精品欧美国产,亚洲国产日韩a在线亚洲

  • <center id="usuqs"></center>
  • 
    
  • c++ 硬幣正反面問(wèn)題

    c++ 硬幣正反面問(wèn)題
    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 a number of times as specified by the user,and count the number of times each side of the coin appears.Print the results of each toss.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.
    The program interaction should look as follows (user inputs are in bold):
    Welcome to the Coin Tossing program.
    Enter the number of tosses (-1 to exit):5
    Flip 1 is a:HEAD
    Flip 2 is a:TAIL
    Flip 3 is a:HEAD
    Flip 4 is a:HEAD
    Flip 5 is a:TAIL
    There were 3 heads and 2 tails in 5 tosses.
    Enter the number of tosses (-1 to exit):-1
    Thank you for using the Coin Flipping program and have a wonderful day.
    其他人氣:706 ℃時(shí)間:2020-03-29 04:21:43
    優(yōu)質(zhì)解答
    //用隨機(jī)數(shù)函數(shù)來(lái)模擬硬幣投擲即可,即rand() % 2即可以得到1或者0.
    //VC6,xp系統(tǒng)
    #include
    #include
    using namespace std;
    int toss();
    int main(void)
    {
    \x05int head,tail,total,num,temp,cnt;
    \x05cout
    我來(lái)回答
    類(lèi)似推薦
    請(qǐng)使用1024x768 IE6.0或更高版本瀏覽器瀏覽本站點(diǎn),以保證最佳閱讀效果。本頁(yè)提供作業(yè)小助手,一起搜作業(yè)以及作業(yè)好幫手最新版!
    版權(quán)所有 CopyRight © 2012-2024 作業(yè)小助手 All Rights Reserved. 手機(jī)版