加勒比久久综合,国产精品伦一区二区,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

    99re8精品视频在线观看| 很黄很黄激情成人| 麻豆极品一区二区三区| 国产农村妇女精品一二区| 日韩黄色在线观看| 久久精品国内一区二区三区| 午夜亚洲影视| 99精品视频在线观看播放| 中文字幕日韩一区二区不卡| 亚洲天堂导航| 亚洲欧洲一区| 欧美三级午夜理伦三级小说| 国产va免费精品观看精品视频| 日韩久久精品| 午夜一级在线看亚洲| 精品国产一区二区三区久久久蜜臀| 影音先锋久久久| 丝袜美腿一区| 免费成人在线网站| 国产精品88久久久久久| 免费精品一区| 欧美日韩123| 日本不卡视频一二三区| 亚洲天堂导航| 免费视频一区二区| 一区在线视频| 久久综合电影| 久久精品福利| 91精品久久久久久综合五月天 | 在线观看一区| 日韩精品第二页| 亚洲精品在线影院| h片在线观看视频免费| 鲁大师影院一区二区三区| 久久一区91| 91精品国产91久久综合| 精品不卡一区| 成人午夜大片| 超碰在线亚洲| 国产精品主播在线观看| 亚洲啊v在线免费视频| 日韩av一二三| 日韩欧美另类中文字幕| 综合伊思人在钱三区| 综合久久综合| 最新亚洲国产| 亚洲人成网站在线在线观看| 国产精品地址| 97久久精品一区二区三区的观看方式 | 亚洲综合另类| 最新国产拍偷乱拍精品 | 麻豆久久精品| 免费在线视频一区| 91视频综合| 亚洲男人av| 你懂得影院夜精品a| www.一区| 青青青伊人色综合久久| 麻豆国产一区二区| 综合久久婷婷| 日本欧美高清| 国产精品sss在线观看av| 成人在线免费观看视频| 日韩精品四区| 亚洲精华国产欧美| 欧美专区一区二区三区| 麻豆mv在线观看| 成人国产精品| 青青草精品视频| 国产精品视频一区视频二区| 日韩福利视频一区| 爱爱精品视频| 国产综合亚洲精品一区二| 欧美婷婷在线| 超碰在线cao| 欧美v亚洲v综合v国产v仙踪林| 日本不卡视频一二三区| 亚洲国产合集| 精品国产乱子伦一区二区| 久久一区二区三区电影| 亚洲欧美日韩国产一区| av在线私库| 欧美亚洲免费| 日韩经典一区二区| 久久激情电影| 蜜桃视频在线观看一区二区| 亚洲综合av一区二区三区| 欧美日韩一区二区三区四区在线观看| 国产aⅴ精品一区二区三区久久| 麻豆国产一区| 亚洲精品成人| 天堂资源在线| 麻豆国产精品一区二区三区 | 九九九精品视频| 国产不卡一区| 99精品在线观看| 男女男精品网站| 一区二区三区国产盗摄| 欧美禁忌电影网| 欧美一区二区三区激情视频 | 国产精品亚洲综合久久| 国产在线一区不卡| 久久蜜桃精品| 国产色播av在线| 欧美日韩一视频区二区| 国产精品午夜av| 蘑菇福利视频一区播放| 日本久久一区| 精品伊人久久| 在线亚洲精品| 国产亚洲人成a在线v网站| 亚洲三级网址| 日韩午夜一区| 美女一区二区视频| 国产伦理久久久久久妇女| 一本色道精品久久一区二区三区| 欧美日韩女优| 日韩精品视频中文字幕| 在线亚洲成人| 国产精品v亚洲精品v日韩精品| 精品高清在线| 丁香六月综合| 亚洲图区在线| 六月天综合网| 亚洲一区 二区 三区| 不卡视频在线| 久久综合综合久久综合| 亚洲一区网址| 四季av在线一区二区三区| 高清精品久久| 一本久久综合| 你懂的视频一区二区| 欧洲视频一区| 日韩国产在线观看| 999久久久91| 国产精品亚洲成在人线| 国产在线播放精品| 欧美成人黑人| 日韩一级淫片| 色网在线免费观看| 日本一区精品视频| 国产在线观看www| 日本精品一区二区三区在线观看视频| 亚洲免费网址| 国产一区二区在线| 男女精品网站| 亚洲成在人线免费观看| 国产精品日韩久久久| 国产精品视频一区视频二区| 亚洲综合激情| 色综合综合网| 丁香六月综合| 精品久久久久久久久久久下田| 欧美亚洲二区| 激情综合久久| 日本欧美大码aⅴ在线播放| 午夜欧美理论片| 国产精品一区二区三区www| 香蕉精品999视频一区二区| 国产精品欧美一区二区三区不卡| 性色一区二区三区| 久久精品一级| 日韩啪啪电影网| 欧美日韩一二三四| 国色天香一区二区| 午夜影院日韩| 综合成人在线| 99精品免费视频| 亚洲激情网站| 精品999日本久久久影院| 亚洲播播91| 在线精品国产| 国产免费久久| 91在线亚洲| 亚洲精品a级片| 亚洲影院天堂中文av色| 久久91导航| 性xxxx欧美老肥妇牲乱| 国产乱码精品一区二区亚洲| 天堂8中文在线最新版在线| 999国产精品视频| 国产麻豆一区二区三区| 日韩欧美看国产| 伊人久久大香线蕉综合热线| 亚洲国产合集| 国产欧美一级| 国产精品成人av| 在线日韩一区| 午夜精品福利影院| 国产九九精品| 91综合网人人| 极品美女一区二区三区| 日韩黄色片在线观看| 久久精品麻豆| 韩国久久久久久| 午夜电影亚洲| 给我免费播放日韩视频| 亚洲精品欧美| www.久久.com| 色综合久久一区二区三区|