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;">

                国产精品天美传媒| 亚洲成人在线免费| 蜜芽一区二区三区| 亚洲免费观看高清完整版在线| 日韩欧美自拍偷拍| 欧美日韩第一区日日骚| 91麻豆产精品久久久久久| 成人伦理片在线| 国产999精品久久久久久| 国产米奇在线777精品观看| 国产一区欧美二区| 成人午夜av影视| 99久久久免费精品国产一区二区| 成人99免费视频| 91在线视频观看| 欧美午夜寂寞影院| 91精品国产综合久久久久久久| 7777精品伊人久久久大香线蕉经典版下载| 欧洲国内综合视频| 欧美肥妇free| 久久婷婷成人综合色| 亚洲色图视频网| 日韩精品乱码免费| 国产高清视频一区| 色国产精品一区在线观看| 欧美日韩高清一区二区| 久久一区二区视频| 亚洲青青青在线视频| 午夜精品福利久久久| 国产一区在线不卡| 色婷婷久久久久swag精品| 这里是久久伊人| 国产丝袜美腿一区二区三区| 亚洲男同性恋视频| 青娱乐精品在线视频| 国产91精品一区二区| 欧美日韩一级二级三级| 国产亚洲欧美日韩俺去了| 亚洲宅男天堂在线观看无病毒| 久久成人羞羞网站| 在线免费视频一区二区| 久久久一区二区三区捆绑**| 亚洲免费av在线| 国产另类ts人妖一区二区| 欧美三级午夜理伦三级中视频| 精品乱人伦一区二区三区| 亚洲精品中文字幕乱码三区| 国产在线不卡视频| 欧美美女直播网站| 亚洲欧美日韩一区二区| 精品一区二区三区欧美| 在线观看日韩av先锋影音电影院| 精品裸体舞一区二区三区| 亚洲精品久久嫩草网站秘色| 国产成人精品影院| 欧美一区二区观看视频| 一区二区三区欧美视频| 国产99久久久国产精品| 欧美一区二区三区在线观看视频| 曰韩精品一区二区| 成人综合婷婷国产精品久久蜜臀 | 亚洲成人av电影在线| 成人免费高清在线观看| 欧美成人艳星乳罩| 日本va欧美va精品发布| 欧美日韩欧美一区二区| 亚洲激情一二三区| 91在线精品秘密一区二区| 精品处破学生在线二十三| 日韩精品一二区| 欧美精品第1页| 婷婷综合五月天| 欧美天堂一区二区三区| 一区二区三区精品视频在线| av色综合久久天堂av综合| 国产精品理伦片| 成人免费看片app下载| 亚洲国产精品av| 99久久夜色精品国产网站| 日韩美女视频一区| 一本大道av伊人久久综合| 亚洲理论在线观看| 欧美探花视频资源| 午夜不卡在线视频| 欧美女孩性生活视频| 日韩精品亚洲一区二区三区免费| 欧美卡1卡2卡| 蜜桃一区二区三区在线观看| 欧美一级欧美三级在线观看| 激情综合色丁香一区二区| 久久香蕉国产线看观看99| 国产69精品久久久久777| 自拍偷拍国产亚洲| 欧美日韩在线三区| 久久国产精品色婷婷| 久久精品视频在线免费观看| 福利91精品一区二区三区| 亚洲女人的天堂| 欧美久久一区二区| 久久不见久久见免费视频1| 国产视频一区不卡| 在线免费观看日本欧美| 免费人成精品欧美精品| 国产欧美一二三区| 欧美色图在线观看| 久久99国产乱子伦精品免费| 中文字幕一区二区三中文字幕| 欧美在线免费播放| 久久99精品久久久久| 中文字幕在线一区免费| 欧美日韩免费高清一区色橹橹 | 国产精品伊人色| 亚洲欧洲三级电影| 欧美福利视频导航| 国产成人综合亚洲91猫咪| 亚洲人123区| 日韩一区和二区| 成人高清视频免费观看| 丝袜亚洲另类欧美| 国产日韩成人精品| 91.xcao| 成人精品免费网站| 男女男精品网站| 亚洲精品视频在线观看网站| 日韩精品中午字幕| 欧美日韩一区二区三区视频| 国产aⅴ综合色| 琪琪久久久久日韩精品| 亚洲欧美日韩系列| 国产欧美日本一区视频| 欧美老女人第四色| 一本色道综合亚洲| 国产激情视频一区二区三区欧美 | 精品一区二区免费视频| 亚洲猫色日本管| 国产日韩欧美综合一区| 日韩欧美专区在线| 欧美在线色视频| 99精品欧美一区二区三区小说 | 欧美精品日日鲁夜夜添| 91亚洲精品久久久蜜桃网站| 精品一区免费av| 日韩成人精品视频| 亚洲成人黄色小说| 一区二区在线观看av| 亚洲欧洲日产国码二区| 久久亚洲免费视频| 欧美videos大乳护士334| 制服.丝袜.亚洲.另类.中文| 欧美日韩一区精品| 欧美日韩激情一区二区三区| 91亚洲国产成人精品一区二三| 国产1区2区3区精品美女| 国产一区二区三区蝌蚪| 紧缚奴在线一区二区三区| 蜜臀99久久精品久久久久久软件| 亚洲va国产天堂va久久en| 亚洲美女区一区| 亚洲精品菠萝久久久久久久| 亚洲美女少妇撒尿| 一区二区三区国产精品| 亚洲综合成人在线视频| 亚洲成国产人片在线观看| 丝袜美腿亚洲一区二区图片| 日韩国产一二三区| 久久99热这里只有精品| 国产精品一区二区果冻传媒| 国产盗摄精品一区二区三区在线| 国产91丝袜在线观看| 91丨porny丨国产入口| 在线看国产一区| 欧美日韩激情在线| 欧美大片在线观看一区| 久久精品视频一区| 一区在线播放视频| 亚洲国产一区视频| 精品一区二区三区在线观看| 国产一区二区在线看| 99麻豆久久久国产精品免费| 欧美少妇性性性| 亚洲精品在线网站| 国产精品视频看| 中文字幕综合网| 五月天国产精品| 国产乱码精品一区二区三| 99re亚洲国产精品| 88在线观看91蜜桃国自产| 欧美成人一区二区三区| 国产精品高清亚洲| 日本人妖一区二区| 成人a区在线观看| 69堂成人精品免费视频| 亚洲丝袜制服诱惑| 宅男在线国产精品| 日韩欧美视频一区| 91精品国产综合久久精品麻豆| 欧美主播一区二区三区美女| 欧美日韩综合色| 91精品国产免费久久综合| 日韩一区二区三区四区|