91精品国产91久久久久久_国产精品二区一区二区aⅴ污介绍_一本久久a久久精品vr综合_亚洲视频一区二区三区

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

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

    合肥圖文信息
    2025年10月份更新拼多多改銷助手小象助手多多出評軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務-企業/產品研發/客戶要求/設計優化
    有限元分析 CAE仿真分析服務-企業/產品研發
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
  • 短信驗證碼 目錄網 排行網

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

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

    91精品国产91久久久久久_国产精品二区一区二区aⅴ污介绍_一本久久a久久精品vr综合_亚洲视频一区二区三区
    自拍偷拍国产精品| 美女亚洲精品| 亚洲一区自拍| 欧美精品自拍偷拍| 国产午夜精品一区二区三区嫩草 | 91免费版pro下载短视频| 国产日韩欧美| 日韩欧美国产综合在线一区二区三区 | 免费在线观看一区| 91免费视频网址| 91久久精品一区二区三| 久久久久久97三级| 裸体健美xxxx欧美裸体表演| 欧美黄色一区二区| 欧美日韩一本到| 亚洲人成网站色在线观看| 国产精品中文字幕日韩精品 | 久久99久久99| 欧美/亚洲一区| 一区二区三区免费观看| 国产在线国偷精品产拍免费yy| 在线精品亚洲| 日韩视频在线你懂得| 午夜天堂影视香蕉久久| 欧美日韩综合精品| 欧美一级久久久| 日韩av一区二区在线影视| 亚洲夜间福利| 久久久高清一区二区三区| 黄色资源网久久资源365| 一区二区三区高清视频在线观看| 亚洲精品一区二区三区精华液| 免费看黄色91| 亚洲欧美日韩精品综合在线观看| 国产欧美日韩亚州综合| 国产大陆亚洲精品国产| 在线一区二区三区| 一区二区三区91| 伊人久久亚洲热| 久久精品视频网| 福利一区二区在线观看| 在线一区二区三区四区五区 | 欧美老肥妇做.爰bbww| 亚洲午夜日本在线观看| 影院欧美亚洲| 日本一区二区免费在线观看视频| 国产99久久久久| 欧美高清dvd| 精品一区二区久久久| 91福利视频久久久久| 日韩不卡手机在线v区| 国产精品入口66mio| 亚洲欧洲制服丝袜| 亚洲视频观看| 亚洲免费伊人电影| 亚洲精品乱码久久久久久蜜桃麻豆| 中文字幕乱码日本亚洲一区二区| 91在线你懂得| 久久综合久久99| 91麻豆蜜桃一区二区三区| 精品av久久707| 欧美福利电影在线观看| 欧美激情综合在线| 黄色在线一区| 一区二区三区美女视频| 性8sex亚洲区入口| 日本特黄久久久高潮| 色哟哟亚洲精品| 精一区二区三区| 91精品国产综合久久久久| 国产精品综合网| 久久综合久久99| 影音欧美亚洲| 亚洲一二三区在线观看| 色猫猫国产区一区二在线视频| 麻豆91免费观看| 日韩欧美一区二区久久婷婷| 99re这里都是精品| 国产精品女主播在线观看| 亚洲高清免费| 午夜伊人狠狠久久| 欧美日韩黄色一区二区| av影院午夜一区| 亚洲欧洲制服丝袜| 在线观看一区二区精品视频| 激情丁香综合五月| 久久亚洲精精品中文字幕早川悠里| 91色porny蝌蚪| 亚洲一区精品在线| 欧美色图在线观看| 成人av电影在线| 亚洲视频小说图片| 一本色道久久综合亚洲aⅴ蜜桃 | 日韩美女视频一区二区| 亚洲欧美国产不卡| 国产成人在线免费观看| 国产精品污www在线观看| 一本到一区二区三区| 国产成人精品午夜视频免费| 国产精品乱码久久久久久| 久久精品主播| 成人国产精品免费观看| 一个色妞综合视频在线观看| 欧美日韩国产免费| 欧美日韩国产不卡在线看| 偷拍自拍另类欧美| 精品国产一区二区三区av性色| 在线观看视频日韩| 极品尤物av久久免费看| 国产精品视频看| 欧美精品一二三区| 极品中文字幕一区| 国产精品一区二区三区网站| 亚洲精品菠萝久久久久久久| 欧美精品tushy高清| 狠狠久久婷婷| 国产永久精品大片wwwapp| 亚洲欧美色图小说| 欧美一区二区视频在线观看| 国产精品毛片在线| 91污片在线观看| 免费一区二区视频| 国产精品高清亚洲| 欧美一级日韩不卡播放免费| 制服诱惑一区二区| 色综合天天综合给合国产| 免费视频最近日韩| 亚洲精品成人天堂一二三| 久久综合久久综合久久综合| 欧洲国内综合视频| 亚洲精品自在在线观看| 波多野结衣精品在线| 蜜臀av性久久久久蜜臀aⅴ流畅| 国产精品欧美久久久久一区二区| 日韩一区二区免费高清| 一本大道久久a久久精二百| 欧美日韩午夜| 成人午夜激情在线| 麻豆精品精品国产自在97香蕉| 亚洲三级小视频| 国产香蕉久久精品综合网| 欧美一级日韩免费不卡| 欧美午夜电影一区| 亚洲欧美日韩精品一区二区| 亚洲性感美女99在线| 欧美激情1区2区| 国产91精品露脸国语对白| 美女一区二区在线观看| 怡红院av一区二区三区| 国产精品视频线看| 国产无一区二区| 久久综合久久鬼色| 日韩精品一区二区三区在线观看| 欧美日韩国产a| 色偷偷成人一区二区三区91| 国产精品一二| 国产欧美成人| 国产色综合网| 亚洲久久视频| 999亚洲国产精| 亚洲清纯自拍| 亚洲美女黄色| 99精品视频网| 一本色道久久99精品综合| 一区二区在线不卡| 雨宫琴音一区二区在线| 精品成人国产| 亚洲国产一区二区在线| 国产精品hd| 1024亚洲| 亚洲一区二区免费看| 亚洲欧美精品| 久久久久久穴| 在线看国产一区| 欧美日韩精品一区视频| 欧美日韩国产中文| 欧美一二三区在线| 日韩午夜在线观看| 久久中文娱乐网| 国产喷白浆一区二区三区| 亚洲国产精品精华液ab| 中文字幕亚洲成人| 一区二区三区在线观看视频| 亚洲成av人片在www色猫咪| 肉肉av福利一精品导航| 麻豆精品一区二区| 福利电影一区二区三区| 成人av在线一区二区三区| 99久久伊人网影院| 韩国久久久久| 男女精品网站| 欧美日韩成人高清| 久久综合视频网| 亚洲你懂的在线视频| 三级不卡在线观看| 国产一区999| 国产精品v欧美精品v日本精品动漫| 亚洲国产精品第一区二区三区| 久久成人精品| 日韩美女主播在线视频一区二区三区|