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

    合肥圖文信息
    2025年10月份更新拼多多改銷助手小象助手多多出評軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務-企業/產品研發/客戶要求/設計優化
    有限元分析 CAE仿真分析服務-企業/產品研發
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
  • 短信驗證碼 目錄網 排行網

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

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

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

          9000px;">

                黄色一级片一级片| 中文字幕免费视频观看| 国产美女www| 911国产在线| 亚洲av无码一区二区三区网址| 久久国产一级片| 国产毛片毛片毛片毛片毛片毛片 | 亚洲精品中文字幕成人片| 色噜噜狠狠一区二区三区狼国成人| 久久精品亚洲天堂| 国产人妻精品一区二区三区| www.精品在线| 99精品全国免费观看| 亚洲精品午夜视频| 中国毛片直接看| 性一交一乱一色一视频麻豆| 三级av免费观看| 手机免费看av| 无码黑人精品一区二区| 午夜精品久久久久久久96蜜桃| 少妇精品无码一区二区| 日韩视频在线观看一区| 日韩免费av网站| 三级a在线观看| 少妇性l交大片7724com| 日韩久久久久久久久久久| 日本中文字幕免费观看| 日产电影一区二区三区| 天天干,夜夜操| 五月天婷婷在线观看| 一区二区免费av| 中文字幕一区二区三区人妻| 亚洲精品久久久狠狠狠爱| 中文字幕一区二区人妻| 亚洲色成人www永久网站| 亚洲天堂日韩av| av在线网站免费观看| 国产成人在线免费视频| 国产无套丰满白嫩对白| 激情av中文字幕| 欧美成人乱码一二三四区免费| 青青草精品视频在线观看| 天天干天天操天天爱| 中日韩av在线| av在线资源观看| 国产一级特黄毛片| 欧美三根一起进三p| 天天操天天摸天天舔| 中文字幕在线观看视频一区| 亚洲一级中文字幕| 国产jk精品白丝av在线观看| 国产一级片播放| 男女做爰猛烈刺激| 四虎国产精品永久免费观看视频| 亚洲不卡视频在线| 亚洲国产精品视频在线| 99在线观看免费| 黄色一级视频免费观看| 色噜噜日韩精品欧美一区二区| 一级做a爰片久久毛片| 69亚洲乱人伦| 国产一级黄色录像| 日本久久精品一区二区| 中文字幕欧美在线观看| 囯产精品一品二区三区| 美女喷白浆视频| 亚欧激情乱码久久久久久久久| 亚洲午夜精品久久久| 国产毛片毛片毛片毛片毛片毛片| 欧美精品成人久久| 中文字幕人妻互换av久久| 国产www在线| 欧美wwwwwww| 最新国产黄色网址| 国产精品视频看看| 日韩av在线播放观看| 亚洲欧美激情国产综合久久久| 国产精品欧美综合| 熟妇人妻系列aⅴ无码专区友真希| 亚洲人与黑人屁股眼交| 狠狠躁狠狠躁视频专区| 五月天婷婷久久| 丰满人妻一区二区三区四区53| 欧美国产成人精品一区二区三区| 亚洲av无码一区二区三区人| 第四色在线视频| 日韩精品一区三区| 999精品视频在线| 男人天堂综合网| 一本一道无码中文字幕精品热| 国产又爽又黄又嫩又猛又粗 | 91成人福利视频| 免费在线观看a视频| 亚洲色图欧美另类| 久久精品国产亚洲av麻豆色欲| 在线观看国产一级片| 国产又粗又黄又爽| 中国一级免费毛片| 久草视频在线免费| 亚洲欧美另类日韩| 欧美丰满熟妇bbbbbb| japanese中文字幕| 日韩一级视频在线观看| 国产大片中文字幕在线观看| 日本网站在线看| 国产精品第六页| 亚洲成人手机在线观看| 国内毛片毛片毛片毛片| 中文字幕丰满孑伦无码专区| 久久激情免费视频| 99久久精品国产一区色| 日日夜夜精品免费| 国产又黄又粗又硬| 亚洲欧美日本在线观看| 人妻体内射精一区二区三区| 超碰成人在线播放| 在线免费看av片| 免费一区二区三区在线观看| www.久久久久久久久久| 新91视频在线观看| 久热在线视频观看| 国产成人三级在线观看视频| 一区二区在线观看免费视频| 久久久久国产免费| 国产成人精品av在线观| 在线免费观看a级片| 男人的天堂官网| 国产精品久久久毛片| 亚欧精品视频一区二区三区| 蜜桃久久精品成人无码av| 成人无码www在线看免费| 小早川怜子久久精品中文字幕| 久久久久久婷婷| 成人免费视频国产| 亚洲欧美精品aaaaaa片| 五月天精品视频| 日本高清久久久| 狠狠人妻久久久久久综合| 一级特黄特色的免费大片视频| 天天综合网在线观看| 久热精品在线播放| 国产呦小j女精品视频| 超碰97人人干| 91免费在线看片| 中文字幕第三区| 婷婷在线精品视频| 欧美一级小视频| 久久久男人的天堂| 国产污污视频在线观看| www.99re6| 91麻豆一区二区| 亚洲欧美偷拍另类| 中文人妻av久久人妻18| 日韩久久久久久久久| 免费在线不卡视频| 蜜桃精品一区二区| 麻豆av免费看| 九九热视频免费| 精品无码人妻少妇久久久久久| 国产高清免费在线观看| aaa级黄色片| 91精品国产乱码久久久| 亚洲污视频在线观看| 亚洲精品久久一区二区三区777 | 天天操天天舔天天干| 青青草华人在线视频| 免费三片在线播放| 欧美大片免费播放器| 美女福利视频网| 免费一级做a爰片久久毛片潮| 久久精品国产露脸对白| 久久久无码一区二区三区| 黄色www视频| 久久久久久久久久久久久久免费看 | 国精产品乱码一区一区三区四区| 国产99视频在线| 国产成人强伦免费视频网站| jizz中国少妇| 懂色av粉嫩av蜜臀av一区二区三区 | 国产波霸爆乳一区二区| 成人午夜视频精品一区| 国产白丝一区二区三区| 国产亲伦免费视频播放| 国产探花在线免费观看| 国产又粗又猛又爽又黄的| 九九热99视频| 欧美 日韩 国产 一区二区三区| 嫩草av久久伊人妇女超级a| 欧美日韩生活片| 天天干天天舔天天操| 一区二区三区免费播放| 中文字幕在线日亚洲9| 一本色道久久综合亚洲| 国产精品成人国产乱| 精品国自产在线观看| 欧美特黄一级片| 西西大胆午夜视频| 91插插插插插插| 国产婷婷色一区二区在线观看| 久久久久久久久久久久久女过产乱|