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爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

          欧美不卡视频| 欧美日韩播放| 国产精品v日韩精品| 一区在线电影| 亚洲欧美一区二区在线观看| 美国十次了思思久久精品导航| 欧美日韩精品福利| 亚洲第一精品夜夜躁人人躁| 亚洲综合不卡| 欧美日韩一区二区三区在线 | 亚洲三级电影在线观看| 亚洲美女尤物影院| 欧美精品国产一区二区| 亚洲免费高清视频| 欧美大片免费久久精品三p| 蜜乳av另类精品一区二区| 亚洲综合久久久久| 国产午夜精品全部视频播放| 欧美伊人精品成人久久综合97| 另类尿喷潮videofree| 亚洲性夜色噜噜噜7777| 最新高清无码专区| 91久久极品少妇xxxxⅹ软件| 亚洲国产免费| 在线不卡欧美| 欧美午夜一区| 另类酷文…触手系列精品集v1小说| 亚洲日本久久| 一本综合精品| 亚洲人成在线播放| 亚洲男人天堂2024| 久久婷婷一区| 国产日韩一级二级三级| 国产精品久久久久久久久久妞妞| 亚洲视频你懂的| 国产亚洲激情视频在线| 欧美激情一区二区三区在线视频观看 | 免费视频最近日韩| 欧美理论电影在线播放| 欧美色精品在线视频| 国产日本欧美一区二区三区在线| 国产精品www994| 欧美激情va永久在线播放| 国产精品成人观看视频免费| 欧美性做爰毛片| 亚洲视频免费| 亚洲国产视频直播| 正在播放欧美视频| 亚洲欧美日韩综合aⅴ视频| 一区二区av| 欧美在线视频网站| 久久久精品五月天| 激情成人综合| 日韩写真视频在线观看| 国产精品欧美在线| 国产裸体写真av一区二区| 国产精品久久久免费| 国产资源精品在线观看| 国产精品一卡二卡| 久久综合一区二区| 欧美精品 国产精品| 国产精品亚洲产品| 欧美精品久久一区| 精品成人a区在线观看| 亚洲国产一区在线| 久久精品国产99精品国产亚洲性色| 国产精品久久久久久久久借妻| 国产一二精品视频| 亚洲淫性视频| 国产精品亚洲第一区在线暖暖韩国| 亚洲少妇自拍| 欧美视频在线观看视频极品| 香蕉乱码成人久久天堂爱免费| 99国产精品国产精品久久 | 一区二区免费看| 亚洲综合不卡| 亚洲成人在线免费| 国产精品久久久久久久一区探花| 久久国产福利国产秒拍| 亚洲黄色尤物视频| 国产拍揄自揄精品视频麻豆| 欧美顶级少妇做爰| 亚洲一区在线免费| 在线激情影院一区| 国产麻豆9l精品三级站| 欧美二区不卡| 久久久国产精品一区| 中日韩在线视频| 亚洲精品日韩欧美| 国产精品久久久久久久久| 欧美一区二区在线播放| 在线综合欧美| 亚洲精品久久嫩草网站秘色 | 欧美在线精品免播放器视频| 亚洲免费不卡| 红桃视频成人| 国产亚洲一级高清| 欧美午夜宅男影院在线观看| 欧美国产亚洲另类动漫| 久久偷窥视频| 亚洲欧美综合| 亚洲图中文字幕| 亚洲精品一二三| 亚洲国产美女| 一色屋精品视频免费看| 国产一区91| 国产亚洲一区精品| 欧美人在线观看| 欧美精品系列| 欧美日韩少妇| 欧美体内谢she精2性欧美| 欧美精品在线一区| 欧美日韩一区在线播放| 欧美成人精品激情在线观看 | 欧美日本高清视频| 欧美国产一区二区三区激情无套| 麻豆成人综合网| 久久综合福利| 玖玖精品视频| 欧美成年人视频网站| 欧美国产一区二区三区激情无套| 欧美另类69精品久久久久9999| 牛人盗摄一区二区三区视频| 欧美久色视频| 国产欧美在线视频| 亚洲高清资源| 亚洲一区二区在线看| 久久久久国产精品一区三寸| 欧美高清你懂得| 国产精品欧美激情| 在线高清一区| 亚洲一级高清| 免费欧美电影| 国产精品久久久久毛片大屁完整版| 国产亚洲欧美一区| 亚洲精品一区在线观看| 性久久久久久| 欧美精品亚洲精品| 国产日本精品| 99精品免费视频| 久久婷婷av| 欧美日韩直播| 精品盗摄一区二区三区| 亚洲一区二区三区乱码aⅴ蜜桃女| 久久久久九九九九| 国产精品捆绑调教| 亚洲三级免费观看| 久久久久久久久久看片| 欧美午夜在线| 最新日韩中文字幕| 久久久久久电影| 国产精品美女久久久免费| 亚洲日本欧美在线| 久久九九电影| 国产欧美一区二区精品仙草咪 | 夜夜夜久久久| 老司机aⅴ在线精品导航| 国产欧美一区二区三区久久| 亚洲视频免费在线观看| 欧美精品色一区二区三区| 在线不卡中文字幕| 久久激情五月婷婷| 国产欧美一区二区精品秋霞影院| 国产一区二区三区直播精品电影 | 精品1区2区3区4区| 午夜激情一区| 国产精品久久久久久久浪潮网站 | 久久久中精品2020中文| 国产精品视频| 亚洲影院免费| 国产精品美女一区二区| 中文欧美在线视频| 欧美日韩一区二区在线| 亚洲精品免费在线观看| 欧美不卡视频一区发布| 亚洲成人原创 | 一本色道久久88亚洲综合88| 蜜臀av在线播放一区二区三区| 红桃视频欧美| 久久免费精品视频| 娇妻被交换粗又大又硬视频欧美| 久久精品最新地址| 一区二区视频免费在线观看 | 欧美亚洲免费| 国产亚洲一区二区在线观看| 欧美在线一区二区三区| 国产综合香蕉五月婷在线| 久久九九热免费视频| 国内精品伊人久久久久av影院| 久久精品国产综合精品| 伊伊综合在线| 欧美精品v日韩精品v国产精品| 最新国产拍偷乱拍精品 | 亚洲欧美在线一区| 国产色综合天天综合网| 久久麻豆一区二区| 最新高清无码专区| 欧美视频在线观看免费| 午夜国产不卡在线观看视频| 国内精品国产成人|