国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看

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

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

    合肥圖文信息
    流體仿真外包多少錢_專業CFD分析代做_友商科技CAE仿真
    流體仿真外包多少錢_專業CFD分析代做_友商科
    CAE仿真分析代做公司 CFD流體仿真服務 管路流場仿真外包
    CAE仿真分析代做公司 CFD流體仿真服務 管路
    流體CFD仿真分析_代做咨詢服務_Fluent 仿真技術服務
    流體CFD仿真分析_代做咨詢服務_Fluent 仿真
    結構仿真分析服務_CAE代做咨詢外包_剛強度疲勞振動
    結構仿真分析服務_CAE代做咨詢外包_剛強度疲
    流體cfd仿真分析服務 7類仿真分析代做服務40個行業
    流體cfd仿真分析服務 7類仿真分析代做服務4
    超全面的拼多多電商運營技巧,多多開團助手,多多出評軟件徽y1698861
    超全面的拼多多電商運營技巧,多多開團助手
    CAE有限元仿真分析團隊,2026仿真代做咨詢服務平臺
    CAE有限元仿真分析團隊,2026仿真代做咨詢服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內
    釘釘簽到打卡位置修改神器,2026怎么修改定
  • 短信驗證碼 豆包網頁版入口 破天一劍 目錄網 排行網

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

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

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    国产精品一区专区欧美日韩| 日本精品一区二区三区不卡无字幕 | 久久久久久国产精品| 日本黄网站色大片免费观看| 国产精品一区二区免费看| 国产精品久久中文字幕| 日韩国产高清一区| 91精品黄色| 伊人色综合久久天天五月婷| 国产一级黄色录像片| 日韩视频一区在线| 欧美一级视频在线播放| 99久久免费国| 亚洲中文字幕久久精品无码喷水 | 69久久夜色精品国产69乱青草| 精品国产一区二区三区在线| 黄色免费福利视频| 久久精视频免费在线久久完整在线看 | 久草一区二区| 无码播放一区二区三区| 97人人模人人爽人人少妇| 久久久久久高潮国产精品视| 免费av一区二区三区| 国产精品偷伦免费视频观看的| 欧美视频免费看欧美视频| 久久久久久久久久久久久久久久av | 91高跟黑色丝袜呻吟在线观看| 欧美极品第一页| 黄色一级片播放| 国产精品久久久久av| 国产一区免费观看| 国产精品成人av在线| 精品少妇在线视频| 欧美巨大黑人极品精男| 国产伦精品一区二区三区四区视频_| 欧美成人中文字幕在线| 国产乱子夫妻xx黑人xyx真爽| 一区二区三区四区免费观看| 99精品在线直播| 午夜免费在线观看精品视频| 91国语精品自产拍在线观看性色| 亚洲aaa激情| 久久黄色片视频| 欧美一级片中文字幕| 日韩中文字在线| 精品午夜一区二区| 欧美激情精品久久久久久大尺度| 国产精品一二三在线| 亚州国产精品久久久| 久久精品国产第一区二区三区最新章节 | 狠狠97人人婷婷五月| 国产精品-区区久久久狼| 韩国三级日本三级少妇99| 欧美久久精品午夜青青大伊人| 成人久久久久久久久| 亚洲 欧美 综合 另类 中字| 九色综合日本| 国产中文字幕91| 亚洲精品一区二区三区蜜桃久| 久久精品ww人人做人人爽| 僵尸世界大战2 在线播放| 欧美激情一区二区三级高清视频| 久久一区免费| 美女精品国产| 少妇性饥渴无码a区免费| 久久精品成人欧美大片| 僵尸世界大战2 在线播放| 中文字幕色一区二区| 久久人91精品久久久久久不卡| 日韩精品一区在线视频| 精品伦理一区二区三区| 久久影院理伦片| 国产一区二区色| 色噜噜狠狠色综合网| 国产精品黄色影片导航在线观看| 99超碰麻豆| 免费日韩中文字幕| 亚洲精品一区二区三区四区五区 | 亚洲综合av影视| 色999日韩欧美国产| 国产伦精品一区二区三区视频孕妇 | 精品欧美一区二区在线观看视频| 一区二区在线不卡| 久久久av一区| 成人国产精品色哟哟| 欧美日韩精品免费观看| 亚洲欧洲在线一区| 国产精品久久久久久久久婷婷 | 黄色网在线视频| 天堂精品视频| 欧美激情18p| 国产成人精品自拍| 91国自产精品中文字幕亚洲| 国产一级不卡毛片| 欧美视频在线播放一区| 三区精品视频观看| 亚洲最大激情中文字幕| 日韩最新av在线| 久久久一本精品99久久精品| 国产亚洲欧美一区二区| 欧美重口乱码一区二区| 亚洲 日韩 国产第一| 欧美日韩aaaa| 国产精品视频免费观看| 国产xxxxx视频| 97精品一区二区三区| 国产一区视频在线| 欧美国产亚洲一区| 日av中文字幕| 日本午夜在线亚洲.国产| 亚洲影院在线看| 精品中文字幕在线| 色琪琪综合男人的天堂aⅴ视频| 91福利视频在线观看| 成人在线观看毛片| 国产麻豆日韩| 国产欧美亚洲日本| 精品日韩在线播放| 霍思燕三级露全乳照| 欧美日韩国产三区| 欧美在线国产精品| 热门国产精品亚洲第一区在线 | yy111111少妇影院日韩夜片| 精品无码久久久久久久动漫| 欧美日韩在线观看一区| 欧美亚洲国产视频小说| 热99这里只有精品| 热99精品只有里视频精品| 日韩国产欧美一区| 青春草国产视频| 欧美一区免费视频| 欧美日韩亚洲在线 | 欧美一区二区综合| 秋霞成人午夜鲁丝一区二区三区 | 国产一区自拍视频| 国产欧美精品久久久| 国产精品亚洲综合| 97伦理在线四区| 国产成人一区二区三区小说| 国产成人永久免费视频| 日韩中文在线视频| 国产精品久久综合av爱欲tv| 欧美精品在线播放| 欧美精品在线观看91| 中文字幕无码精品亚洲资源网久久| 一区二区不卡视频| 日日噜噜夜夜狠狠久久丁香五月| 婷婷精品国产一区二区三区日韩 | 久久精品影视伊人网| 国产精品免费电影| 国产精品视频免费一区| 国产成人精品一区二区三区福利 | 日韩中文字幕av在线| 日日碰狠狠丁香久燥| 熟女视频一区二区三区| 日韩一区不卡| 日本三级久久久| 日本久久久网站| 激情视频在线观看一区二区三区| 国内精品久久久久久久久| 韩国v欧美v日本v亚洲| 精品少妇在线视频| 国产伦精品一区二区三区四区视频_| 2019日韩中文字幕mv| 久久久国内精品| 日韩在线视频观看| 色噜噜狠狠狠综合曰曰曰| 国产激情视频一区| 国产精品视频免费观看| 久久成人精品一区二区三区| 久久福利视频网| 一区二区三区四区久久| 亚洲五码在线观看视频| 欧洲中文字幕国产精品| 狠狠精品干练久久久无码中文字幕| 国产一区二区视频免费在线观看 | 久久精品综合一区| 久艹在线免费观看| 丝袜美腿亚洲一区二区| 国产精品久久久久久久7电影| 欧美激情乱人伦| 涩涩日韩在线| 日本在线观看一区| 欧洲精品亚洲精品| 麻豆中文字幕在线观看| 高清国产一区| 国产成+人+综合+亚洲欧洲| 日韩中文字幕在线看| 久久中国妇女中文字幕| 午夜免费日韩视频| 黄色片视频在线免费观看| 国产伦精品一区二区三毛| 久久免费精品视频| 久久久精品国产一区二区三区| 欧美另类在线播放| 日韩一级在线免费观看| 国内视频一区| 91观看网站| 中文字幕无码精品亚洲35| 日韩久久久久久久久久久久|