国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女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怎么修改定
  • 短信驗證碼 寵物飼養 十大衛浴品牌排行 suno 豆包網頁版入口 wps 目錄網 排行網

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

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

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    国产精品一二三视频| 精品国偷自产在线视频| 日本久久久久久久久久久| 国产精品久久久久高潮| 国产成人精品优优av| 色狠狠av一区二区三区香蕉蜜桃| 久久国产精品视频在线观看| 久久久在线视频| 国产成人一区二区三区别 | 欧美亚洲国产视频小说| 日本黄网站免费| 欧美在线视频一区二区三区| 加勒比成人在线| 国产日韩欧美日韩大片| 国产原创精品| 国产美女作爱全过程免费视频| 国产性生交xxxxx免费| 免费观看国产成人| 国产在线精品一区免费香蕉| 国产精品一区二区三区免费| 91精品国产综合久久香蕉922| 久久免费一级片| 久久精品最新地址| 久久99精品久久久久久噜噜| 亚洲午夜精品一区二区三区| 欧美一区二区三区免费视| 人人妻人人做人人爽| 国内精品久久影院| 高清视频一区| 九色综合婷婷综合| 久久福利视频导航| 亚洲精品乱码久久久久久自慰| 日本一区精品| 麻豆视频成人| 国产极品精品在线观看| 国产精品色午夜在线观看| 欧美精品久久久久久久免费观看| 色一情一乱一乱一区91| 免费毛片网站在线观看| 97精品一区二区视频在线观看| 国产激情在线观看视频| 国产精品久久精品国产| 亚洲精品人成| 蜜桃久久影院| 国产福利片一区二区| 国产精品成人av性教育| 天天干天天色天天爽| 免费国产黄色网址| 91禁国产网站| 国产精品久久久久久久久久久久久 | 日本三级韩国三级久久| 国内精品视频一区| 国产精品91在线观看| 国产精品久久中文字幕| 丁香五月网久久综合| 国内精品视频一区| 久久精品99国产| 久久99久国产精品黄毛片入口| 日本wwww视频| 成人免费淫片aa视频免费| 日韩视频永久免费观看| 一区视频二区视频| 欧美xxxx黑人又粗又长精品 | 福利视频一二区| 久久精品国产清自在天天线| 亚洲国产一区二区精品视频| 国产综合色一区二区三区| 九一免费在线观看| 午夜精品美女自拍福到在线| 国产日韩在线精品av| 精品激情国产视频| 亚洲精品不卡| 国产性生交xxxxx免费| 日韩中文字幕第一页| 无码人妻精品一区二区蜜桃网站 | 天堂av一区二区| 国产伦理久久久| 久久中国妇女中文字幕| 欧美精品一区在线| 色偷偷888欧美精品久久久| 亚洲国产精品一区二区第一页| 国内精品久久久久久久果冻传媒| 久久本道综合色狠狠五月| 日韩一级片一区二区| 91免费福利视频| 亚洲色婷婷久久精品av蜜桃| 成人一区二区av| 一区二区视频在线免费| 国产乱淫av片杨贵妃| 精品国产综合久久| 国产小视频免费| 欧美成人精品在线播放| 精品一区二区三区毛片| 国产精品久久久久免费a∨| 红桃av在线播放| 久久五月天综合| 国产日韩精品一区观看| 国产精品欧美在线| 国内精品久久久| 国产精品美女网站| 美女视频久久| 精品国产电影| 成人3d动漫一区二区三区| 欧美极品在线视频| 高清视频在线观看一区| 在线免费一区| 91极品视频在线| 日本一区免费观看| 久久精品电影网站| 免费国产黄色网址| 欧美激情在线观看视频| av在线不卡观看| 天天综合色天天综合色hd| 国产不卡精品视男人的天堂| 日本不卡一区二区三区四区| 精品国产一区二区三区久久| 国模精品系列视频| 欧美激情一二区| 久久一区免费| 秋霞成人午夜鲁丝一区二区三区 | 久久久久久一区二区三区| 欧美在线免费观看| 操91在线视频| 91免费在线观看网站| 青青草视频国产| 欧美精品午夜视频| 99精品一级欧美片免费播放| 日韩美女视频中文字幕| 国产精品伦子伦免费视频| 国产欧美日韩视频| 日本在线观看一区| 国产精品久久久久久久久男| 91久久国产精品| 欧美激情国产日韩| 亚洲专区中文字幕| 国产成人精品一区二区在线| 国产狼人综合免费视频| 日韩av电影在线播放| 国产精品美女久久| 国产精品av免费| 黄色av免费在线播放| 中文字幕一区二区三区四区五区| 久久99精品久久久久久青青日本| 蜜桃在线一区二区三区精品| 亚洲在线视频观看| 国产成人无码a区在线观看视频| 国产精品一码二码三码在线| 日韩一二三区不卡在线视频| 久精品免费视频| 国产成人精品一区二区在线| 91精品久久久久久久久久久| 欧美性资源免费| 日韩在线观看a| 欧美激情视频一区二区三区不卡| 久草热视频在线观看| 成人做爽爽免费视频| 热久久美女精品天天吊色| 亚欧洲精品在线视频免费观看| 国产精品久久久久久久美男| 91国内在线视频| 国产日韩欧美综合精品| 欧洲日韩成人av| 性色av香蕉一区二区| 久久99视频免费| 国产精品国产精品| 日韩亚洲成人av在线| 91国产一区在线| 国产剧情久久久久久| 免费国产一区| 欧美日韩免费精品| 日韩免费中文专区| 午夜午夜精品一区二区三区文| 欧美巨猛xxxx猛交黑人97人| 国产精品偷伦一区二区| 国产成人无码a区在线观看视频| 久久精品视频16| 久久综合九色综合网站| 97久久精品在线| 成人亚洲综合色就1024| 国产三区在线视频| 免费拍拍拍网站| 黄色一级一级片| 欧美 日本 亚洲| 黄色特一级视频| 国内外免费激情视频| 黄色www在线观看| 欧美精品七区| 狠狠综合久久av| 精品日产一区2区三区黄免费 | av网址在线观看免费| 国产精品一区二区a| 国产又黄又猛视频| 免费h精品视频在线播放| 国内自拍中文字幕| 欧美精品一区三区在线观看| 欧美性在线观看| 欧美激情视频一区二区三区| 精品91一区二区三区| 免费一级特黄特色毛片久久看| 黄页网站在线观看视频|