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

          欧美午夜电影网| 亚洲一区综合| 国产精品日韩精品欧美在线| 亚洲欧美另类国产| 影音先锋在线一区| 欧美日韩精品综合| 欧美一区二区三区四区在线| 亚洲高清在线观看一区| 国产精品家教| 欧美.日韩.国产.一区.二区| 亚洲欧美国产视频| 精品不卡一区二区三区| 久久精品国产精品| 亚洲视频精品在线| 一区二区在线观看视频| 国产精品video| 久久野战av| 午夜免费在线观看精品视频| 在线观看91久久久久久| 国产精品一区二区你懂的| 欧美高清你懂得| 久久www成人_看片免费不卡| 日韩一级网站| 最新国产拍偷乱拍精品| 国产一区二区黄色| 欧美天天影院| 亚洲午夜国产成人av电影男同| 国产一区自拍视频| 国产精品久久久一本精品| 欧美黄色一级视频| 久久免费精品视频| 久久av一区二区三区| 在线视频亚洲一区| 亚洲人妖在线| 亚洲高清视频一区| 国内精品美女av在线播放| 欧美午夜精品久久久久免费视 | 免费的成人av| 久久久欧美精品| 久久久久欧美精品| 亚洲麻豆av| 国产欧美日韩一区二区三区在线观看| 欧美精品亚洲| 欧美日韩成人精品| 欧美精品久久99久久在免费线| 欧美a级片网| 欧美激情视频给我| 欧美日韩日本视频| 国产精品久久久久久模特| 欧美性jizz18性欧美| 国产精品乱人伦一区二区| 久久综合久色欧美综合狠狠| 欧美一区二区视频免费观看| 午夜国产精品视频| 久久精品欧美| 麻豆av一区二区三区久久| 欧美a级片网| 欧美日韩国产成人在线91| 欧美日韩在线三区| 国产精品久久久久久户外露出| 国产精品午夜视频| 韩国精品久久久999| 影院欧美亚洲| 99re热精品| 亚洲已满18点击进入久久| 欧美在线视频免费观看| 另类春色校园亚洲| 久久精品一区二区| 久久精品国产综合| 久久久久久久999精品视频| 久久久成人精品| 欧美刺激性大交免费视频| 欧美久久综合| 国产精品尤物福利片在线观看| 国产亚洲精品久久飘花| 亚洲国产国产亚洲一二三| 亚洲无线视频| 免费在线成人av| 欧美日韩裸体免费视频| 理论片一区二区在线| 国产精品户外野外| 在线免费观看成人网| 中日韩在线视频| 久久久精彩视频| 欧美日韩一区二区三区视频 | 夜夜嗨av一区二区三区网站四季av | 欧美三级电影大全| 狠狠色2019综合网| 亚洲国产一二三| 亚洲免费在线看| 欧美成人中文| 一区二区三区在线观看欧美| 亚洲网址在线| 欧美韩日亚洲| 亚洲第一网站免费视频| 午夜视频一区二区| 欧美色欧美亚洲高清在线视频| 激情文学综合丁香| 99精品视频一区二区三区| 久久中文字幕一区| 国产亚洲欧美中文| 欧美一二区视频| 国产精品你懂的在线| av成人毛片| 欧美日韩国产在线观看| 亚洲国产裸拍裸体视频在线观看乱了| 亚洲国产精品精华液2区45| 欧美一区亚洲一区| 国产精品亚洲第一区在线暖暖韩国| 亚洲精品一区二区网址| 欧美 日韩 国产在线 | 一区二区日韩免费看| 嫩草国产精品入口| 国产亚洲欧美一区二区| 欧美一区二区精品久久911| 国产精品五月天| 午夜一级在线看亚洲| 国产人成精品一区二区三| 欧美一二区视频| 国产一区二区三区无遮挡| 亚洲欧美国产三级| 国产精品网站一区| 久久久91精品国产一区二区精品| 国产一区二三区| 开心色5月久久精品| 亚洲第一精品影视| 欧美激情在线观看| 日韩视频二区| 欧美日韩亚洲视频| 亚洲欧美高清| 激情视频一区| 欧美精品一区二区在线播放| 亚洲美女一区| 国产伦精品一区二区三区| 欧美中文字幕不卡| 亚洲国产毛片完整版 | 一区二区精品在线观看| 欧美日韩成人综合天天影院| 一区二区三区在线视频播放 | 欧美日韩国产免费观看| 亚洲午夜三级在线| 国产亚洲制服色| 欧美日韩四区| 欧美3dxxxxhd| 欧美在线视频免费播放| 一本色道久久88精品综合| 亚洲大胆av| 国产午夜一区二区三区| 欧美日韩一区在线播放| 另类成人小视频在线| 欧美在线免费一级片| 一区二区三区免费看| 亚洲丰满在线| 国内外成人在线视频| 国产女主播一区二区三区| 欧美午夜免费| 欧美日韩三级| 欧美精品一区二区三区四区| 久久在线免费观看视频| 久久av在线| 香蕉久久一区二区不卡无毒影院| 中文欧美日韩| 亚洲一区欧美二区| 在线亚洲欧美| 亚洲视频免费看| 日韩视频二区| 99综合视频| 这里只有精品电影| 正在播放亚洲| 午夜欧美大尺度福利影院在线看 | 欧美激情亚洲国产| 欧美精品久久久久久久| 欧美成人免费网站| 欧美在线三级| 久久午夜精品| 女人天堂亚洲aⅴ在线观看| 免播放器亚洲一区| 欧美福利视频网站| 欧美日本国产| 欧美视频在线视频| 国产精品久久久久久久久果冻传媒| 国产精品久久久久9999高清| 国产精品视频区| 国模精品一区二区三区| 一区二区三区在线观看视频| 亚洲人成精品久久久久| 99riav1国产精品视频| 亚洲影视九九影院在线观看| 亚洲免费在线| 久久日韩精品| 欧美日韩一区二区欧美激情| 国产精品二区二区三区| 国产一区二区久久久| 伊人狠狠色j香婷婷综合| 亚洲激情第一区| 亚洲午夜电影在线观看| 久久久久久高潮国产精品视| 欧美华人在线视频| 国产精品自拍网站| 最新日韩av|