加勒比久久综合,国产精品伦一区二区,66精品视频在线观看,一区二区电影

合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

代寫 tic-tac-toe game 、代做Python/Java程序語言

時(shí)間:2024-06-09  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯(cuò)



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.
請(qǐng)加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp























 

掃一掃在手機(jī)打開當(dāng)前頁(yè)
  • 上一篇:菲律賓9A簽證有哪些(9A簽證詳細(xì)介紹)
  • 下一篇:菲律賓旅游簽證回國(guó)流程(回國(guó)不能帶什么東西)
  • 無相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    2025年10月份更新拼多多改銷助手小象助手多多出評(píng)軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務(wù)-企業(yè)/產(chǎn)品研發(fā)/客戶要求/設(shè)計(jì)優(yōu)化
    有限元分析 CAE仿真分析服務(wù)-企業(yè)/產(chǎn)品研發(fā)
    急尋熱仿真分析?代做熱仿真服務(wù)+熱設(shè)計(jì)優(yōu)化
    急尋熱仿真分析?代做熱仿真服務(wù)+熱設(shè)計(jì)優(yōu)化
    出評(píng) 開團(tuán)工具
    出評(píng) 開團(tuán)工具
    挖掘機(jī)濾芯提升發(fā)動(dòng)機(jī)性能
    挖掘機(jī)濾芯提升發(fā)動(dòng)機(jī)性能
    海信羅馬假日洗衣機(jī)亮相AWE  復(fù)古美學(xué)與現(xiàn)代科技完美結(jié)合
    海信羅馬假日洗衣機(jī)亮相AWE 復(fù)古美學(xué)與現(xiàn)代
    合肥機(jī)場(chǎng)巴士4號(hào)線
    合肥機(jī)場(chǎng)巴士4號(hào)線
    合肥機(jī)場(chǎng)巴士3號(hào)線
    合肥機(jī)場(chǎng)巴士3號(hào)線
  • 短信驗(yàn)證碼 目錄網(wǎng) 排行網(wǎng)

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
    ICP備06013414號(hào)-3 公安備 42010502001045

    欧美日韩一区二区三区不卡视频| 欧美日韩国产色综合一二三四| 精品69视频一区二区三区| 婷婷亚洲图片| 日韩av三区| 精品亚洲a∨| 蜜臀av国产精品久久久久| 九色丨蝌蚪丨成人| 亚洲人成网www| 久久精品超碰| 漫画在线观看av| 五月天久久久| 91久久精品无嫩草影院| 在线欧美激情| 激情久久一区二区| 春色校园综合激情亚洲| 好吊视频一区二区三区四区| 国产伦理久久久久久妇女| 91精品在线免费视频| 日本在线视频一区二区| 免费欧美日韩| 亚洲电影影音先锋| 国产成人夜色高潮福利影视| 国产精品中文字幕亚洲欧美| 国产精品资源| 国产综合色区在线观看| 久久国产精品99国产| 欧美肉体xxxx裸体137大胆| 日韩一区二区三区色| 伊人久久大香伊蕉在人线观看热v| 成人在线高清| 色资源二区在线视频| 噜噜爱69成人精品| 日韩亚洲国产欧美| 激情五月色综合国产精品| 欧美成人专区| 黄色工厂这里只有精品| 偷拍欧美精品| 亚洲福利精品| 久久久久久久久99精品大| eeuss国产一区二区三区四区| 亚洲电影一级片| 亚洲欧洲专区| 欧美激情91| 国内视频精品| 日本v片在线高清不卡在线观看| 国产一区二区主播在线| 色在线视频观看| 亚洲深夜视频| 色综合桃花网| 午夜激情电影在线播放| 91一区二区| а√天堂中文资源在线bt| 三级电影一区| 免费的成人av| 国产不卡123| 日韩精品二区| 青娱乐极品盛宴一区二区| 蜜臀久久精品| 成人精品一区二区三区电影| 天天综合网站| 国产情侣一区| 国内精品久久久久久久97牛牛 | 98视频精品全部国产| 亚洲精品一二三**| 久久久久国产精品一区二区 | 狠狠综合久久| 99成人在线| 久久国产精品99国产| 春色校园综合激情亚洲| 亚洲十八**毛片| 福利一区二区| 另类欧美日韩国产在线| 国产视频一区二区在线播放| 日韩av电影天堂| 久久超级碰碰| 欧美在线影院| 首页欧美精品中文字幕| 国产拍在线视频| 亚洲国产第一| 你懂的亚洲视频| 视频一区日韩精品| 久久综合国产| 男人的天堂亚洲| 日本精品不卡| 亚洲最新色图| 欧美色图麻豆| 欧美码中文字幕在线| 久久亚洲视频| 日本电影久久久| 91精品国产色综合久久不卡粉嫩| 久久久久久亚洲精品美女| 秋霞影院一区二区三区| 一本久道久久综合狠狠爱| 91偷拍一区二区三区精品| 亚洲黄网站黄| 精品国内自产拍在线观看视频 | 久热re这里精品视频在线6| 97精品在线| 麻豆国产精品777777在线| 综合伊思人在钱三区| 私拍精品福利视频在线一区| 男女精品视频| 国产日韩欧美| 日韩激情精品| 午夜激情久久| 欧美香蕉视频| 欧美日本三级| 九一成人免费视频| 色偷偷偷在线视频播放| 在线免费观看亚洲| 99久久婷婷国产综合精品电影√| 热久久一区二区| 亚洲视频二区| 国产精品成人自拍| 美女国产精品| 毛片一区二区三区| 久久精品亚洲成在人线av网址| 西西裸体人体做爰大胆久久久| 一本色道久久综合亚洲精品不| 视频一区欧美日韩| 日韩网站中文字幕| 国产一区二区在线观| 欧美中文一区| 久久久久看片| 亚洲人成久久| 欧美调教在线| 黄色在线观看www| 成人午夜888| 久久影院100000精品| 日韩欧美在线中字| 综合干狼人综合首页| 仙踪林久久久久久久999| 你懂得影院夜精品a| 精品亚洲a∨一区二区三区18| 精品1区2区3区4区| 欧美a一区二区| 999国产精品视频| 成人看片网站| 亚洲欧美日本国产| 亚洲三级欧美| 我要色综合中文字幕| 国产精品外国| 成人污污视频| 亚洲在线日韩| 综合在线一区| 一本久道久久综合婷婷鲸鱼| 捆绑调教美女网站视频一区| 久久九九99| 激情中国色综合| 久久免费黄色| 欧美激情啪啪| 中国av一区| 日本欧美久久久久免费播放网| 欧美粗暴jizz性欧美20| 日韩福利视频网| 欧洲乱码伦视频免费| 免费亚洲一区| 亚洲国产一区二区在线观看 | 国产精品宾馆| 日本高清不卡一区二区三区视频| www.爱久久| ww久久综合久中文字幕| 欧美一区自拍| 99精品国产福利在线观看免费| 成人午夜国产| 亚洲高清网站| 先锋资源久久| 国产欧美日韩在线一区二区| 蜜桃视频第一区免费观看| 日韩激情毛片| 欧美午夜三级| sdde在线播放一区二区| 影音先锋日韩精品| av中文字幕在线观看第一页| 国产成人高清精品免费5388| 精品国产黄a∨片高清在线| 午夜影院欧美| 亚洲第一论坛sis| 免费在线观看一区| 亚洲大全视频| 日韩极品少妇| 欧美成人xxxx| 伊人久久亚洲影院| 精品麻豆剧传媒av国产九九九| 日韩电影一区| 激情婷婷综合| 天堂俺去俺来也www久久婷婷 | 日韩国产一区二| 男女精品视频| 免费看久久久| 一区二区影视| 国产精品亚洲一区二区三区在线观看| 亚洲成人99| 亚洲女娇小黑人粗硬| 国产一区二区三区国产精品| 中文日韩在线| 99视频精品全国免费| 国产免费播放一区二区| 粉嫩av一区二区三区四区五区|