99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

代寫 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簽證詳細介紹)
  • 下一篇:菲律賓旅游簽證回國流程(回國不能帶什么東西)
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
    合肥機場巴士2號線
    合肥機場巴士2號線
    合肥機場巴士1號線
    合肥機場巴士1號線
  • 短信驗證碼 豆包 幣安下載 AI生圖 目錄網

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

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

    99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

          9000px;">

                亚洲免费观看高清完整版在线观看熊 | 日韩欧美高清在线| 老司机午夜精品| 五月婷婷久久丁香| 午夜a成v人精品| 欧美—级在线免费片| 国产三级精品视频| 国产精品国产三级国产专播品爱网 | 成人中文字幕在线| 国内精品久久久久影院薰衣草| 亚洲亚洲精品在线观看| 亚洲成人综合视频| 久久国产精品99久久久久久老狼| 国产乱码精品一品二品| 亚洲欧美综合色| 国产精品污污网站在线观看| 亚洲精品在线电影| 久久在线免费观看| 中文字幕一区二区三区在线播放| 久久久精品国产免大香伊 | 国产99久久久国产精品潘金| 色88888久久久久久影院野外| 亚洲欧美日韩久久精品| 国产在线一区二区| 粉嫩一区二区三区在线看| 韩国av一区二区三区四区 | 欧美一区二区三区爱爱| 国产视频一区在线观看| 最新中文字幕一区二区三区| 亚洲精品伦理在线| 久久精品久久精品| 欧美三级午夜理伦三级中视频| 久久久久久久久久电影| 最新国产成人在线观看| 亚洲视频综合在线| 美女在线视频一区| 国产a区久久久| 日韩欧美国产综合| 亚洲精品少妇30p| 男女性色大片免费观看一区二区| 国产不卡视频在线观看| 欧美日本一区二区| 亚洲少妇最新在线视频| 麻豆成人免费电影| 91色在线porny| 国产亚洲欧美色| 天堂av在线一区| 91精品国产综合久久久久久久| 亚洲欧美激情在线| 99精品久久免费看蜜臀剧情介绍| 久久久精品欧美丰满| 国产精品综合视频| 国产精品久久久久国产精品日日| 国产九色sp调教91| 欧美国产日韩a欧美在线观看| 寂寞少妇一区二区三区| 国产清纯白嫩初高生在线观看91| 国产麻豆一精品一av一免费 | 国产精品久久久久久久裸模 | 国产成人av一区二区三区在线 | 性做久久久久久免费观看| 97久久超碰精品国产| 亚洲综合区在线| 精品视频一区二区不卡| 日韩欧美亚洲国产另类 | 亚洲欧美自拍偷拍| 日韩欧美一级二级三级| 丁香五精品蜜臀久久久久99网站| 国产精品视频线看| 91精品国产aⅴ一区二区| 国产精品夜夜嗨| 日韩国产欧美在线观看| 国产性天天综合网| 欧美一区二区大片| 在线亚洲免费视频| 99视频精品在线| 丁香婷婷综合激情五月色| 日本亚洲电影天堂| 天堂资源在线中文精品| 一区二区三区在线视频观看| 国产精品看片你懂得| 久久综合色婷婷| 欧美www视频| 欧美精品一区二区三区蜜臀 | 国产亚洲成aⅴ人片在线观看| 91年精品国产| 成人av片在线观看| 国产精品一区二区视频| 精品在线播放免费| 久久99精品国产.久久久久久| 视频一区国产视频| 日韩国产欧美视频| 狠狠色伊人亚洲综合成人| 国产精品一区二区免费不卡| 国产综合久久久久久久久久久久| 开心九九激情九九欧美日韩精美视频电影| 亚洲精品v日韩精品| 亚洲天堂免费在线观看视频| 亚洲综合一二区| 国产在线视视频有精品| 国产高清无密码一区二区三区| 91蝌蚪porny| 日韩一区在线看| 精品国产乱码久久久久久久| 国产日韩av一区| 亚洲成人中文在线| 国产一区二区在线免费观看| 成人美女在线观看| 欧美三级电影精品| 久久婷婷国产综合国色天香| 最新欧美精品一区二区三区| 亚洲一区二区三区视频在线播放 | 国产一区日韩二区欧美三区| 一区精品在线播放| 欧美一区二区福利在线| 欧美一区二区三区公司| 日产国产欧美视频一区精品| 久久久午夜电影| 国产精品福利一区二区三区| 久久精品免费观看| 欧美男人的天堂一二区| 亚洲欧美国产三级| 91啦中文在线观看| 国产精品国产成人国产三级| 国产一区二区精品在线观看| 日韩欧美一区二区视频| 午夜精品在线视频一区| 成人一道本在线| 日韩二区三区在线观看| 日韩一区二区视频| 一区二区三区欧美亚洲| 91蜜桃在线观看| 国产精品美女久久久久久久网站| 五月激情丁香一区二区三区| 日本丶国产丶欧美色综合| 亚洲欧美成人一区二区三区| 成人免费视频视频在线观看免费| 久久午夜国产精品| 99re这里只有精品首页| 亚洲免费视频成人| 制服丝袜亚洲网站| 不卡av在线网| 国产精品久久久爽爽爽麻豆色哟哟 | 国产欧美一区二区精品性| 成人午夜视频网站| 亚洲成人激情av| 久久久精品综合| 91丨porny丨蝌蚪视频| 日韩精品一级中文字幕精品视频免费观看 | 欧美日精品一区视频| 亚洲影视在线播放| 久久99精品国产91久久来源| 韩国成人福利片在线播放| 久久午夜羞羞影院免费观看| 91久久香蕉国产日韩欧美9色| 婷婷开心久久网| 亚洲国产精品黑人久久久 | 欧美日韩一区二区三区不卡| 国产一区二区三区在线观看免费 | 欧美性色综合网| 94-欧美-setu| 国产乱子轮精品视频| 日韩电影在线看| 国产亚洲精品aa午夜观看| 欧美日韩日日骚| 欧美在线免费播放| 色国产精品一区在线观看| 色婷婷久久久综合中文字幕| 成人黄色在线视频| 色哟哟精品一区| 一本到不卡精品视频在线观看| 成人黄色电影在线| 懂色av一区二区三区蜜臀| 粉嫩蜜臀av国产精品网站| 激情图片小说一区| 波多野结衣欧美| 在线观看国产一区二区| 7777精品伊人久久久大香线蕉超级流畅 | 欧美日韩国产综合久久| 色婷婷av久久久久久久| 欧美体内she精高潮| 日韩欧美一卡二卡| 国产精品美女久久久久aⅴ| 亚洲欧洲www| 亚洲高清免费在线| 成人美女视频在线观看18| 在线观看视频91| 国产精品国模大尺度视频| 婷婷中文字幕一区三区| 国产精品一区在线| 欧美色图激情小说| 中文字幕欧美国产| 天堂蜜桃91精品| 色综合久久综合网97色综合| 成人精品小蝌蚪| 91亚洲精品久久久蜜桃| 欧美精品粉嫩高潮一区二区| 中文字幕av免费专区久久| 日韩高清在线一区| 欧美日韩国产一区|