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

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

代寫(xiě) tic-tac-toe game 、代做Python/Java程序語(yǔ)言

時(shí)間:2024-06-09  來(lái)源:合肥網(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ī)打開(kāi)當(dāng)前頁(yè)
  • 上一篇:菲律賓9A簽證有哪些(9A簽證詳細(xì)介紹)
  • 下一篇:菲律賓旅游簽證回國(guó)流程(回國(guó)不能帶什么東西)
  • 無(wú)相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科技CAE仿真
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路流場(chǎng)仿真外包
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真技術(shù)服務(wù)
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲勞振動(dòng)
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)40個(gè)行業(yè)
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)4
    超全面的拼多多電商運(yùn)營(yíng)技巧,多多開(kāi)團(tuán)助手,多多出評(píng)軟件徽y1698861
    超全面的拼多多電商運(yùn)營(yíng)技巧,多多開(kāi)團(tuán)助手
    CAE有限元仿真分析團(tuán)隊(duì),2026仿真代做咨詢服務(wù)平臺(tái)
    CAE有限元仿真分析團(tuán)隊(duì),2026仿真代做咨詢服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內(nèi)
    釘釘簽到打卡位置修改神器,2026怎么修改定
  • 短信驗(yàn)證碼 寵物飼養(yǎng) 十大衛(wèi)浴品牌排行 suno 豆包網(wǎng)頁(yè)版入口 目錄網(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

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    久久久久se| 亚洲欧美丝袜| 福利视频一二区| 国产精品亚洲片夜色在线| 国产主播喷水一区二区| 国产中文字幕免费观看| 国产日韩精品一区二区| 成人精品久久久| 国产经典一区二区三区| 国产v亚洲v天堂无码久久久| 久久久久久久国产| 国产精品三区www17con| 国产精品私拍pans大尺度在线| 久久久国产精品免费| 国产精品成人av性教育| 中文精品一区二区三区| 大波视频国产精品久久| 欧美日韩精品久久| 国产欧美高清在线| 国产成人在线视频| 国产精品免费区二区三区观看| 久久国产精品久久国产精品| 一区二区三区av| 日本一本a高清免费不卡| 国内精品久久影院| 97久久精品人搡人人玩| 日日骚久久av| 国产精品推荐精品| 在线视频福利一区| 日本免费高清一区二区| 国产一级做a爰片久久毛片男| 91超碰中文字幕久久精品| 精品国产一区二区三区久久狼黑人 | 国产精品男人爽免费视频1| 欧美猛交ⅹxxx乱大交视频| 亚洲一区二区中文| 欧美韩国日本在线| 91精品国产综合久久香蕉| 国产精品久久久亚洲| 日韩中文在线字幕| 国产精品一区视频网站| 国产精品视频区| 日韩最新中文字幕| 国产伦精品一区二区三毛| 久久av一区二区三区亚洲| 欧美另类在线播放| 日本一区二区免费高清视频| 免费av网址在线| 国产精欧美一区二区三区| 欧美成人免费在线观看| 日本欧美色综合网站免费| 国产日韩精品久久| 日韩视频第一页| 亚洲国产高清国产精品| 国内精品久久久久久久久| 国产xxxxx在线观看| 亚洲最大的av网站| 免费国产a级片| 色噜噜狠狠狠综合曰曰曰| 亚洲欧美日韩在线综合| 国产在线观看一区二区三区| www.欧美三级电影.com| 色香蕉在线观看| 99re在线视频上| 一区二区三区在线视频111| 欧美日韩大片一区二区三区| 国产精品99久久久久久久久 | 国产成人在线一区二区| 一本色道久久综合亚洲二区三区| 欧美日韩福利在线| 久久久久久久一| 亚洲第一精品区| www.浪潮av.com| 在线观看成人av| 国模精品视频一区二区| 国产精品视频内| 欧美日韩第二页| 日韩色av导航| 欧美日韩在线不卡视频| 久久久久无码国产精品一区| 日韩av123| 久久久久久这里只有精品| 日本一区网站| 久久99精品久久久久久秒播放器 | 国产精品永久免费在线| 国产精品国产亚洲精品看不卡| 人妻精品无码一区二区三区| 久久久久一区二区三区| 热99久久精品| 久久精品久久久久| 精品日产一区2区三区黄免费| 精品国模在线视频| 免费在线a视频| 国产精品高潮视频| 国产美女久久久| 亚洲v日韩v综合v精品v| 国产xxxx振车| 欧美亚洲国产成人精品| 国产精品免费在线| 国产婷婷一区二区三区| 一区二区三区观看| 久久视频这里有精品| 人妻久久久一区二区三区| 国产精品欧美在线| 国产女大学生av| 一道本在线观看视频| 91精品国产一区二区三区动漫| 亚洲精品欧美日韩| 久久久久久久久久久国产| 欧美理论一区二区| 精品国产综合久久| 91精品国产综合久久久久久蜜臀| 午夜精品久久久久久99热 | 国产99视频精品免视看7| av在线亚洲男人的天堂| 日韩av免费看| 国产精品久久国产精品99gif| 国产精品一区二区三区观看| 日日橹狠狠爱欧美超碰| 久久久久久久成人| 国产一区 在线播放| 亚洲最大成人网色| 日韩亚洲欧美中文高清在线| 国产日韩一区二区| 日韩av影视| 精品九九九九| 国产成人亚洲综合青青| 国产在线一区二| 亚洲aⅴ日韩av电影在线观看| 久久国产色av免费观看| 精品少妇一区二区三区在线| 亚洲不卡中文字幕无码| 国产精品免费看久久久无码| 97国产精品免费视频| 日韩国产高清一区| 国产aaa一级片| 精品国偷自产在线| 久久久亚洲综合网站| 国产一区二区三区播放| 日本999视频| 亚洲欧洲一区二区| 久久综合免费视频| www.欧美三级电影.com| 俄罗斯精品一区二区三区| 精品人妻大屁股白浆无码| 日韩一级在线免费观看| 欧美乱妇高清无乱码| 日韩一区在线视频| 99精品一级欧美片免费播放| 欧美另类一区| 天堂av一区二区| 欧美人交a欧美精品| 久久久av电影| 国产成人在线视频| 白白操在线视频| 国产无限制自拍| 欧美 日韩 国产一区| 日韩免费av片在线观看| 日韩一级片一区二区| 中文网丁香综合网| 国产99久久九九精品无码| 国产精品欧美一区二区| 久草精品在线播放| 久久网站免费视频| 国产精品一区二区不卡视频| 国产资源在线视频| 黄色一级片av| 欧美高清性xxxxhd| 欧美亚洲视频一区| 欧洲熟妇精品视频| 欧洲成人在线观看| 日韩精品欧美专区| 日韩av高清在线播放| 午夜精品99久久免费| 午夜精品一区二区三区在线观看 | 国产一区在线播放| 国内精品小视频在线观看| 日本久久久久久久| 色爱区成人综合网| 色中色综合成人| 三区精品视频| 日本精品久久久久影院| 日韩免费观看网站| 欧美主播一区二区三区美女 久久精品人| 日本一本a高清免费不卡| 日本高清不卡在线| 奇米影视亚洲狠狠色| 欧美综合第一页| 男女超爽视频免费播放| 欧美亚洲伦理www| 欧美日韩性生活片| 极品日韩久久| 欧美日韩一级在线| 狠狠色噜噜狠狠狠狠色吗综合 | 欧美日韩一区二| 精品日产一区2区三区黄免费 | 日韩视频精品在线| 久久精品国产成人精品| 国产精品视频男人的天堂| 国产精品国产对白熟妇|