99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

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

代寫 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簽證詳細介紹)
  • 下一篇:菲律賓旅游簽證回國流程(回國不能帶什么東西)
  • 無相關信息
    合肥生活資訊

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

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

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

    99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

          9000px;">

                国产69精品一区二区亚洲孕妇| 91久久免费观看| 97精品电影院| 日韩亚洲国产中文字幕欧美| 国产精品电影一区二区| 七七婷婷婷婷精品国产| 99精品热视频| 国产日韩欧美在线一区| 人人精品人人爱| 日本韩国精品在线| 国产精品国产三级国产有无不卡 | 欧美人与性动xxxx| 国产精品丝袜91| 国产麻豆日韩欧美久久| 日韩一区二区麻豆国产| 男女男精品网站| 日韩情涩欧美日韩视频| 久久激情综合网| 日韩欧美国产三级电影视频| 国产福利电影一区二区三区| 欧美亚洲国产bt| 亚洲成人资源在线| 欧美电影一区二区| 美女在线观看视频一区二区| 制服丝袜亚洲色图| 免费人成网站在线观看欧美高清| 欧美日本一区二区在线观看| 婷婷成人激情在线网| 91精品国产福利在线观看| 日韩精品免费视频人成| 国产精品免费视频一区| 欧美成人官网二区| 国产电影一区在线| 久久精品一区二区三区不卡| 国内成+人亚洲+欧美+综合在线| 在线观看国产91| 久久九九全国免费| 欧美草草影院在线视频| 久久精品一区二区三区不卡牛牛 | 亚洲va欧美va人人爽| 欧美三级午夜理伦三级中视频| 亚洲国产一区二区视频| 久久国产剧场电影| 久久精品网站免费观看| 国产999精品久久久久久| 欧美日韩免费在线视频| 一区二区在线观看免费| 欧美性videosxxxxx| 精品综合免费视频观看| 国产精品久久久久久久久图文区 | 日韩精品一区二区三区中文精品| 日本欧美在线观看| 中文字幕亚洲电影| 884aa四虎影成人精品一区| 国精产品一区一区三区mba桃花| 亚洲欧美一区二区三区久本道91| 欧美日韩亚洲综合在线 欧美亚洲特黄一级 | 91久久国产最好的精华液| 图片区小说区区亚洲影院| 久久久综合视频| 宅男噜噜噜66一区二区66| 国产一区二区三区在线观看免费 | 亚洲靠逼com| 中文一区一区三区高中清不卡| 91久久精品一区二区三区| 国产精品一二三区在线| 免费看欧美女人艹b| 亚洲www啪成人一区二区麻豆| 欧美国产97人人爽人人喊| 欧美一区午夜视频在线观看| 色av一区二区| 色综合天天综合网天天狠天天| 日韩午夜在线播放| 亚洲成人激情社区| 亚洲午夜视频在线观看| 亚洲一区在线视频观看| 亚洲高清在线视频| 奇米精品一区二区三区在线观看一| 日韩黄色在线观看| 久久国产精品99久久久久久老狼 | 91精品国产综合久久蜜臀| 欧美日韩亚洲另类| 欧美一区二区福利在线| 精品国免费一区二区三区| 26uuu精品一区二区三区四区在线| 国产亚洲欧美一区在线观看| 国产午夜精品一区二区三区嫩草| 国产亚洲制服色| 日韩一区欧美小说| 亚洲一线二线三线视频| 丝袜亚洲另类丝袜在线| 国产成人自拍网| 8x福利精品第一导航| 中文字幕精品在线不卡| 天天综合色天天综合色h| 国产成+人+日韩+欧美+亚洲| 91电影在线观看| 国产偷v国产偷v亚洲高清| 亚洲第一搞黄网站| 91搞黄在线观看| 国产精品乱码久久久久久| 日韩电影一区二区三区四区| 丁香婷婷深情五月亚洲| 26uuu欧美| 国产aⅴ精品一区二区三区色成熟| 欧美日韩亚洲综合在线| 婷婷丁香久久五月婷婷| 91一区一区三区| 欧美日本一区二区| 中文字幕免费观看一区| 久久精品国产亚洲一区二区三区| 色域天天综合网| 亚洲精品欧美激情| 欧美精品xxxxbbbb| 国产精品久久久久久亚洲毛片 | 91社区在线播放| 亚洲欧美自拍偷拍| 色婷婷亚洲精品| 亚洲图片有声小说| 在线综合亚洲欧美在线视频| 日韩福利视频网| 国产人成一区二区三区影院| 国产69精品久久久久毛片 | 夜色激情一区二区| 欧美性一级生活| 捆绑紧缚一区二区三区视频| 成人免费观看av| 色婷婷久久99综合精品jk白丝| 欧美一区中文字幕| 日韩黄色免费电影| 国产精品乱码久久久久久| 欧美一区二区三区免费观看视频| 日日骚欧美日韩| 国产午夜亚洲精品不卡| 欧美日韩国产bt| av激情综合网| www.爱久久.com| 亚洲妇熟xx妇色黄| 欧美国产日韩在线观看| 欧美日韩电影在线| 国产一区二区剧情av在线| 亚洲一区欧美一区| 欧美国产综合一区二区| 欧美顶级少妇做爰| 国产**成人网毛片九色| 图片区小说区国产精品视频| 国产精品丝袜在线| 中文字幕在线免费不卡| 精品噜噜噜噜久久久久久久久试看| 91啦中文在线观看| av在线不卡电影| 国产麻豆精品在线观看| 国产精一区二区三区| 狠狠色2019综合网| 国产很黄免费观看久久| 成人午夜电影小说| 欧美探花视频资源| 日韩欧美一二三区| 久久久久久日产精品| 国产精品区一区二区三| 亚洲欧美日韩精品久久久久| 中文字幕在线不卡一区| 亚洲激情男女视频| 青草av.久久免费一区| 国产成人免费高清| 91视频免费看| 欧美一区二区三区免费视频| 日韩欧美在线一区二区三区| 国产亚洲欧美一级| 午夜亚洲国产au精品一区二区| 日韩**一区毛片| 成人97人人超碰人人99| 欧美精品乱码久久久久久按摩| 欧美mv日韩mv国产网站| 日韩伦理电影网| 国产在线播放一区| 欧美午夜片在线观看| 久久久久9999亚洲精品| 亚洲国产成人va在线观看天堂| 国产麻豆一精品一av一免费 | 亚洲国产成人精品视频| 精品亚洲国产成人av制服丝袜 | 午夜精品一区二区三区三上悠亚| 国产揄拍国内精品对白| 91丨国产丨九色丨pron| 精品国产髙清在线看国产毛片| 亚洲一区二区av电影| www.欧美亚洲| 国产精品久久久久影院亚瑟| 麻豆高清免费国产一区| 777精品伊人久久久久大香线蕉| 一区二区高清在线| 在线观看网站黄不卡| 亚洲欧美在线另类| 99九九99九九九视频精品| 亚洲日穴在线视频| 精品视频在线免费看| 奇米在线7777在线精品| 久久精品亚洲国产奇米99| aaa国产一区|