日韩精品一区二区三区高清_久久国产热这里只有精品8_天天做爽夜夜做爽_一本岛在免费一二三区

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

代寫 tic-tac-toe game 、代做Python/Java程序語言

時間:2024-06-09  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



Homework 4 Revision 1
Due: June 6, 2024; late due date is June 11
Points: 100
1. In problem 1, if the square is occupied, you need to give the error message. “%c has played %d,%d\n” (where “%c” is either “X” or “O”, whichever is already in the square, and “%d,%d” are the co-ordinates of the occupied square).
2. In problem 1, the dimensions of the “O” was added; it is to be 5 × 5 centered in the square.
3. For all problems, the exit status code is 0.

(25 points) Enhance the tic-tac-toe game so 2 people can play. To do this, you need to add an“O” that, like the “X”, is drawn in the square. Then prompt the user for a square identifier, and alternate between drawing “X”s and “O”s at those locations on the board. The first move is for “X”. You need to detect and reject when a user plays a square that is already taken. Stop after the board is full (that is, 9 plays). You do not have to worry about who wins.
The “O” is to be 5 × 5, centered in the middle of the square.

Here are the messages your program should print to the standard output:

The tic-tac-toe board, with “X”s and “O”s as appropriate;
When it is “X”’s turn, print “X’s turn > ” (note the space after the “>”); and
When it is “O”’s turn, print “O’s turn > ” (again, note the space after the “>”).
Here are the error messages; all are to be printed on the standard error:

When the user enters only 1 co-ordinate: “Need 2 co-ordinates\n” (the ‘\n’ is a newline);
When there is an illegal character in the input: “Illegal character in input "%c"\n” (the “%c” is to print the offending character); and
When the square is already occupied: “%c has played %d,%d\n” (where “%c” is either “X” or “O”, whichever is already in the square, and “%d,%d” are the co-ordinates of the occupied square); and
When an invalid set of co-ordinates are entered: “%d,%d” is not a valid square; the numbers must be between 1 and 3 inclusive\n” (each %d is one of the invalid numbers).
If the program reads an end of file at the prompt, print a newline and quit.

The program should exit with an exit status code of 0.

Please call your program ttt4a.c and submit it through Gradescope. A sample executable, used to generate the Gradescope validation outputs, is available on the CSIF at /home/bishop/hw4/ttt4a.

(25 points) Now enhance what you did for question 1. Have your program determine when the game is over — that is, there is a winner (three in a row, column, or diagonal) or a tie (no winner and all 9 squares on the board are full). Print the results on the standard output:
If X wins, print “Game over! X won!\n”;
If O wins, print “Game over! O won!\n”; or
If X wins, print “Game over! It’s a tie!\n”.
Please call your program ttt4b.c and submit it through Gradescope. A sample executable, used to generate the Gradescope validation outputs, is available on the CSIF at /home/bishop/hw4/ttt4b.

(50 points) The birthday problem asks how many people must be in a room so that the probability of two of them having the same birthday is 0.5. This problem has you explore it by simulation. Basically, you will create a series of lists of random numbers of length n = 2, …, and look for duplicates. You will do this 5000 times for each length. For each length, count the number of lists with at least 1 duplicate number; then divide that number by 5000. That is the (simulated) probability that a list of n generated numbers has at least one duplicate. As the random numbers you generate are between 1 and 365 (each one corresponding to a day of the year), this simulates the birthday problem.
Now, breathe deeply and calm down. We will do this in steps; you only have to turn the final program in to Canvas (not Gradescope).

First, detecting duplicates. Write a function called hasduplicates(bday) that takes an array bday and returns 1 if it contains a duplicate element, and 0 if it does not. For example, if bday is

int bday[] = { 1, 2, 3, 4, 5, 5, 2 };
then hasduplicates(bday) returns 1 and if

int bday[] = { 1, 2, 3, 4, 5, 6, 7 };
then hasduplicates(bday) returns 0.
Now, deal with one set of birthdays. Write a function called onetest(count) that generates a list of count random integers between 1 and 365 inclusive, and returns 1 if it contains a duplicate element, and 0 if it does not. Please use the function hasduplicates(bday) to test for duplicates.
Now for the probability for count people. Write a function probab(count, num) that runs num tests of count people, and counts the number of tests with duplicates. It returns the fraction of the tests with duplicates; that is, the number of duplicates divided by num.
Now for the demonstration. Start with 2 people, and begin adding people until the probability of that many people having two people with a birthday in common is over 0.5. (In other words, start with a list of 2 elements, and increase the number of elements in the list until the simulation shows a probability of 0.5 that a number in the list is duplicated.) Print each probability; your output should look like this:

For  2 people, the probability of 2 birthdays in common is 0.001400
For  3 people, the probability of 2 birthdays in common is 0.006600
For  4 people, the probability of 2 birthdays in common is 0.015200
For  5 people, the probability of 2 birthdays in common is 0.025400
For  6 people, the probability of 2 birthdays in common is 0.041400
For  7 people, the probability of 2 birthdays in common is 0.053000
For  8 people, the probability of 2 birthdays in common is 0.082000
For  9 people, the probability of 2 birthdays in common is 0.092200
For 10 people, the probability of 2 birthdays in common is 0.121800
Hint: Don’t be surprised if your probabilities are slightly different than the ones shown in the sample output. As randomness is involved, it is very unlikely your numbers will match the ones shown here.
To turn in: Please call your program bday.c and submit it through Canvas (not Gradescope). A sample executable is available on the CSIF at /home/bishop/hw4/ttt4b.
請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp























 

掃一掃在手機打開當前頁
  • 上一篇:菲律賓9A簽證有哪些(9A簽證詳細介紹)
  • 下一篇:菲律賓旅游簽證回國流程(回國不能帶什么東西)
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    有限元分析 CAE仿真分析服務-企業/產品研發/客戶要求/設計優化
    有限元分析 CAE仿真分析服務-企業/產品研發
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
    合肥機場巴士2號線
    合肥機場巴士2號線
  • 短信驗證碼 豆包 幣安下載 目錄網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    日韩精品一区二区三区高清_久久国产热这里只有精品8_天天做爽夜夜做爽_一本岛在免费一二三区

      <em id="rw4ev"></em>

        <tr id="rw4ev"></tr>

        <nav id="rw4ev"></nav>
        <strike id="rw4ev"><pre id="rw4ev"></pre></strike>
        国产精品午夜视频| 伊人精品在线| 国产精品99久久久久久白浆小说| 国产精品成人av性教育| 在线视频精品一区| 国产免费一区二区三区香蕉精| 国产精品一区二区男女羞羞无遮挡| 国产欧美精品一区二区色综合| 亚洲国产成人av| 久久一区二区三区国产精品| 玉米视频成人免费看| 欧美午夜免费影院| 国产精品久久久久aaaa樱花| 久久人人九九| 亚洲激情啪啪| 亚洲天堂激情| 久久嫩草精品久久久久| 国产精品热久久久久夜色精品三区| 亚洲精品视频一区| 亚洲美女精品一区| 最新日韩av| 久久久久久伊人| 欧美激情第10页| 久久久青草青青国产亚洲免观| 欧美日韩国产片| 欧美大片91| 亚洲人成网站影音先锋播放| 久久激情综合网| 亚洲日本在线视频观看| 美女久久网站| 亚洲人体大胆视频| 国产精品一二三视频| 欧美人与性动交α欧美精品济南到| 激情久久久久久| 国产精品久久久久国产a级| 欧美日韩国产美| 一本色道久久综合亚洲二区三区| 一区二区三区欧美日韩| 在线亚洲高清视频| 欧美日韩国产在线| 欧美va天堂| 亚洲一区二区三区免费在线观看| 欧美激情在线| 亚洲深夜福利在线| 欧美色精品在线视频| 亚洲大胆在线| 久久婷婷影院| 欧美日韩中国免费专区在线看| 国产综合色一区二区三区| 久久一区二区三区超碰国产精品| 欧美色图首页| 亚洲国产精品电影| 一区国产精品| 欲色影视综合吧| 久久成人精品| 99国产麻豆精品| 国产亚洲欧美色| 欧美精品久久一区二区| 国产精品久久精品日日| 欧美激情 亚洲a∨综合| 欧美大片一区二区三区| 欧美日本国产视频| 久久久人成影片一区二区三区| 亚洲人在线视频| 欧美14一18处毛片| 欧美成人精品影院| 欧美日本一区二区视频在线观看| 亚洲国产精品久久| 免费欧美在线视频| 欧美日韩免费高清| 国产视频一区在线观看一区免费| 欧美日韩三级电影在线| 欧美午夜片在线免费观看| 欧美国产精品va在线观看| 欧美成人一区二区三区在线观看| 亚洲电影中文字幕| 红桃视频成人| 最新国产乱人伦偷精品免费网站| 亚洲激情在线观看视频免费| 国产性天天综合网| 国产精品黄色在线观看| 午夜在线一区| 亚洲一二区在线| 狠狠色综合网站久久久久久久| 91久久国产精品91久久性色| 老司机aⅴ在线精品导航| 激情自拍一区| 午夜一区在线| 国产精品美女一区二区| 欧美日韩成人一区二区三区| 亚洲欧美日韩成人| 亚洲中午字幕| 欧美日一区二区三区在线观看国产免| 欧美成人免费小视频| 亚洲欧洲一区二区三区| 欧美黄色成人网| 精品成人一区| 欧美日韩三级电影在线| 欧美激情视频一区二区三区在线播放| 欧美影片第一页| 黑人一区二区| 鲁大师影院一区二区三区| 国产一区二区三区最好精华液| 亚洲一区免费在线观看| 亚洲国产精品久久久久秋霞蜜臀| 亚洲免费视频在线观看| 亚洲素人在线| 国外成人性视频| 久久综合久久综合久久综合| 亚洲视频视频在线| 亚洲国产精品国自产拍av秋霞| 香蕉成人伊视频在线观看| 欧美喷潮久久久xxxxx| 亚洲一区二区三区四区在线观看| 国产日韩欧美夫妻视频在线观看| 亚洲国产中文字幕在线观看| 久久精品一区二区三区不卡| 亚洲激情一区| 国产亚洲精品久| 一区二区三区国产| 亚洲人成网站在线观看播放| 日韩视频―中文字幕| 欧美在线3区| 美女国产一区| 国产丝袜一区二区| 久久精品国产清高在天天线| 模特精品裸拍一区| 国产精品av久久久久久麻豆网| 一区二区精品| 在线视频国产日韩| 欧美日韩一区二区高清| 国产女同一区二区| 国产偷自视频区视频一区二区| 久久久欧美一区二区| 一区二区视频在线观看| 午夜激情亚洲| 亚洲宅男天堂在线观看无病毒| 午夜精品久久久久影视| 国产欧美日韩伦理| 亚洲肉体裸体xxxx137| 国产欧美一区二区精品忘忧草| 久久大逼视频| 久久综合九色综合欧美就去吻| 精品av久久久久电影| 久久精品综合一区| 你懂的国产精品| 欧美日韩亚洲国产一区| 尤物视频一区二区| 午夜精品久久久久久| 久久精品国产亚洲a| 亚洲电影欧美电影有声小说| 亚洲乱码精品一二三四区日韩在线| 国产精品久久久久久久午夜片| 国产精品三区www17con| 欧美黑人在线播放| 亚洲影视综合| 欧美日韩亚洲一区三区| 欧美三级欧美一级| 一本色道久久综合狠狠躁篇的优点| 午夜伦欧美伦电影理论片| 国产日韩在线播放| 一区二区日韩伦理片| 亚洲电影成人| 国产精品毛片va一区二区三区|