国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女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在线免费观看
    日韩**中文字幕毛片| 99热成人精品热久久66| 久久久久国产精品免费| 久久99亚洲精品| 欧美成人亚洲成人日韩成人| 国产精品网站入口| 国产精品激情av在线播放| 国产精品国模大尺度私拍| 久久国产精品久久久久久| 中文字幕乱码一区二区三区| 在线观看污视频| 亚洲一区精彩视频| 色乱码一区二区三在线看| 欧美一级特黄aaaaaa在线看片| 日本高清久久一区二区三区| 日韩精品视频久久| 欧美极品欧美精品欧美| 美女被啪啪一区二区| 99免费在线视频观看| 久99久视频| 国产精品久久999| 一区二区三区视频| 日本a视频在线观看| 免费久久久久久| 97免费中文视频在线观看| 久久精品国产一区二区三区不卡| 俺也去精品视频在线观看| 国产精品十八以下禁看| 欧美巨猛xxxx猛交黑人97人| 亚洲精品一品区二品区三品区| 日韩国产高清一区| 欧美精品国产精品久久久| 国产伦精品一区二区三区四区免费 | 欧美伦理91i| 亚洲国产精品123| 欧美亚洲另类在线| 成人黄色中文字幕| 久久精品99久久香蕉国产色戒| 在线日韩av永久免费观看| 日韩精品大片| 高清国语自产拍免费一区二区三区 | 久久久97精品| 中文字幕无码不卡免费视频| 日本一二三区视频在线| 国产在线青青草| 国产成人精品久久久| 欧美伦理91i| 青青草国产精品一区二区| 国产精品一区在线观看| 久久久久久久久久国产精品| 欧美精品福利在线| 欧美交换配乱吟粗大25p| 97人人模人人爽人人少妇| 国产精品久久久久久网站| 色综合影院在线观看| 国产一区二区黄色| 日韩视频在线免费| 午夜精品久久久久久久白皮肤| 精品无码一区二区三区爱欲 | 国产成人av网| 自拍日韩亚洲一区在线| 欧美变态另类刺激| 国产不卡av在线| 亚洲视频导航| 国产欧美韩国高清| 国产成人免费高清视频| 日韩av不卡在线| 97精品国产97久久久久久粉红| 麻豆国产精品va在线观看不卡| 欧美无砖专区免费| 久草视频这里只有精品| 少妇人妻在线视频| 91蜜桃网站免费观看| 一区二区三视频| 国产伦精品一区二区三区高清版| 国产精品久久久久久影视| 欧美影院久久久| 国产精品av免费| 亚洲啪啪av| av片在线免费| 久久久久久国产| 国产精品一区二区三区免费视频 | 亚洲欧洲另类精品久久综合| 国产欧美亚洲日本| 欧美日本啪啪无遮挡网站| 国产日韩欧美自拍| 欧美激情综合色| 国产精品自拍网| 中文字幕一区二区三区精彩视频| 国产日韩欧美精品在线观看| 久久亚洲欧美日韩精品专区| 国产又粗又猛又爽又黄的网站| 国产精品成久久久久三级| 国产又黄又爽免费视频| 九九精品在线播放| 国产精品亚洲一区| 亚洲视频欧美在线| 国产高清精品一区二区| 日韩精品一区二区三区久久 | 精品日韩美女| 中文字幕日韩精品无码内射| 成人中文字幕在线播放| 亚洲一区美女视频在线观看免费| 97福利一区二区| 天堂av一区二区| 日韩在线一区二区三区免费视频| 欧美中文字幕精品| 国产精品国内视频| 成人精品小视频| 日韩av大片在线| 国产精品视频网址| 国产剧情久久久久久| 视频一区二区三区在线观看| 久久久久久有精品国产| 韩国一区二区av| 中文字幕欧美人妻精品一区| 久久久一二三四| 加勒比在线一区二区三区观看| 色综合久久88色综合天天看泰| 91久久久久久国产精品| 区一区二区三区中文字幕| 欧美精品在线第一页| 国产精品6699| 欧美日韩国产精品激情在线播放| 欧美日本中文字幕| 久久久久亚洲精品| 国产欧美一区二区三区久久| 欧美一级在线播放| 国产精品观看在线亚洲人成网| 91精品国自产在线观看| 青青草视频在线视频| 久久国产精品久久久久久久久久| 久久久综合av| 国产欧美一区二区三区久久人妖| 欧美一级免费在线观看| 久久伊人精品天天| 九九九九免费视频| www.中文字幕在线| 国内精品一区二区| 日本一本草久p| 欧美激情综合色综合啪啪五月| 国产l精品国产亚洲区久久| 国产色婷婷国产综合在线理论片a| 日本一区二区三区视频免费看| 欧美日韩xxx| 北条麻妃在线一区二区| 97精品久久久中文字幕免费| 欧美成人精品免费| 日韩一区二区三区高清| 九九久久综合网站| 国产精品视频一区二区三区四| 国产精品av网站| 成人av资源在线播放| 国产综合在线观看视频| 欧美一级片在线播放| 在线观看免费91| 精品国产乱码久久久久久108| 视频在线观看99| 国产不卡一区二区三区在线观看 | 91精品国产91久久久久青草| 国产一区二区三区免费不卡| 日韩极品视频在线观看| 无码人妻精品一区二区蜜桃百度| 国产99午夜精品一区二区三区| 久久久精品一区二区| 国产suv精品一区二区三区88区 | 久久久久久久国产精品| 国产精品69精品一区二区三区| 国产乱码一区| 国产三级中文字幕| 国产综合久久久久| 国内精品国产三级国产在线专 | 国产成人综合精品| 91精品免费久久久久久久久| 国产麻豆日韩| 国产伦精品一区二区三区四区视频 | 一区二区欧美日韩| 欧美日韩国产第一页| 国产精品免费在线免费| 久久久久久久999精品视频| 久久96国产精品久久99软件| 久久久女女女女999久久| 91免费国产网站| 97精品视频在线| 国产精品9999| 国产高清精品在线观看| 国产精品com| 国产成人高潮免费观看精品| 国产z一区二区三区| 国产成人精品免费视频| 久久精品久久精品国产大片| 久久一区二区三区av| 国产成人+综合亚洲+天堂| 久久久久久久激情| 久久精品影视伊人网| 久久亚洲精品成人| 一区二区在线不卡| 日韩一区二区三区资源| 日本高清久久一区二区三区| 欧美亚洲国产免费|