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

                日韩视频免费直播| 91在线云播放| 日韩精品一区二| 韩国一区二区视频| 国产清纯白嫩初高生在线观看91 | 精品一区精品二区高清| 久久麻豆一区二区| 日本韩国精品在线| 久久精品999| 一区二区三区在线免费视频| 91精品免费在线观看| 国产成人精品免费| 亚洲成在人线在线播放| 91精品国产欧美日韩| caoporen国产精品视频| 蜜桃视频在线观看一区| 亚洲黄网站在线观看| 精品国产一区二区精华| 欧洲精品在线观看| 成人国产精品免费观看| 精品亚洲成a人在线观看 | 国产剧情一区二区| 亚洲午夜精品网| 亚洲精品一区二区三区影院 | 欧美一级理论片| 日韩精品自拍偷拍| 国产日韩欧美a| 一区二区三区在线视频免费观看| 在线亚洲+欧美+日本专区| 日本大香伊一区二区三区| 欧美日韩国产综合一区二区三区 | 奇米色777欧美一区二区| 亚洲欧美日韩国产手机在线| 欧美一区二区三区免费| 精品国产乱码久久久久久牛牛 | 亚洲嫩草精品久久| 视频一区视频二区在线观看| 亚洲激情图片小说视频| 亚洲123区在线观看| 韩国精品免费视频| 日本韩国一区二区三区| 欧美一区二区三区影视| 成人免费在线视频| 中文字幕在线不卡| 婷婷中文字幕一区三区| 日韩在线一区二区| 成人av免费在线播放| 制服丝袜亚洲色图| 一区二区三区久久| 国产大陆精品国产| 欧美日本一道本| 亚洲欧美一区二区三区极速播放| 国产亚洲精品中文字幕| 国产视频在线观看一区二区三区 | 日韩电影在线观看网站| 视频在线观看一区二区三区| 激情综合色播五月| 欧美三级乱人伦电影| 在线不卡一区二区| 日韩精品一区二| 五月天中文字幕一区二区| 不卡av在线免费观看| 精品国产免费一区二区三区四区 | 欧美日韩一本到| 亚洲色图在线播放| 亚洲成人午夜影院| 成人av在线电影| 久久久精品黄色| 蜜乳av一区二区三区| 欧美猛男超大videosgay| 国产精品免费免费| 午夜电影网亚洲视频| 日本高清不卡一区| 亚洲蜜桃精久久久久久久| av午夜一区麻豆| 国产精品三级电影| 99re免费视频精品全部| 最新日韩在线视频| 在线观看亚洲a| 一区二区三区自拍| 91官网在线免费观看| 亚洲成人在线网站| 宅男在线国产精品| 美女一区二区三区在线观看| 日韩片之四级片| 黄色成人免费在线| 久久综合久久鬼色| 日本aⅴ精品一区二区三区| 日韩亚洲欧美综合| 国模冰冰炮一区二区| 欧美精彩视频一区二区三区| 99久久精品国产精品久久| 亚洲综合无码一区二区| 国产精品综合二区| 亚洲视频一区在线| 7777精品伊人久久久大香线蕉超级流畅 | 伊人开心综合网| 欧美日韩国产一二三| 日本成人在线网站| 国产日本一区二区| 91性感美女视频| 久久蜜桃av一区二区天堂| 成人一区在线看| 日韩美女在线视频| 国产成人综合网站| 最新成人av在线| 欧美一区午夜视频在线观看| 国产乱码字幕精品高清av| 最近中文字幕一区二区三区| 欧美精品久久天天躁| 国产xxx精品视频大全| 精品毛片乱码1区2区3区| 亚洲成人动漫一区| 国产亚洲午夜高清国产拍精品| 五月天一区二区三区| 久久蜜桃香蕉精品一区二区三区| 亚洲成人午夜电影| 欧美va日韩va| 91丨porny丨最新| 麻豆精品视频在线观看视频| 亚洲精品视频在线| 久久久久久免费毛片精品| 欧美日韩一区中文字幕| 成人小视频在线| 秋霞国产午夜精品免费视频| 亚洲精品国产品国语在线app| av在线一区二区三区| 日韩电影一区二区三区四区| 中文字幕在线视频一区| 国产成人综合亚洲91猫咪| 亚洲国产精品久久久久秋霞影院| 91在线porny国产在线看| 久久 天天综合| 亚洲一区二区在线播放相泽| 国产欧美日韩麻豆91| 日韩午夜电影在线观看| 91福利视频网站| 99久久国产免费看| 粉嫩在线一区二区三区视频| 精品一区二区免费视频| 午夜电影久久久| 亚洲一二三区在线观看| 亚洲天堂网中文字| 久久精品亚洲麻豆av一区二区| 顶级嫩模精品视频在线看| 精油按摩中文字幕久久| 久久精品国产一区二区| 亚洲sss视频在线视频| 成人欧美一区二区三区小说| 中国色在线观看另类| 国产性做久久久久久| 久久综合久久综合久久| 久久精品人人做人人爽人人| 久久综合色天天久久综合图片| 91色porny在线视频| www.在线欧美| 99久久精品免费看国产| 91丝袜美腿高跟国产极品老师 | 久久99热狠狠色一区二区| 午夜天堂影视香蕉久久| 亚洲一区二区三区视频在线播放| 欧美一区二区三区小说| 欧美日韩国产天堂| 日韩一卡二卡三卡四卡| 精品欧美一区二区在线观看| 久久蜜桃一区二区| 中文字幕亚洲在| 亚洲宅男天堂在线观看无病毒| 欧美精品一区二区三区久久久 | 久久久久久久久蜜桃| 国产欧美精品一区二区色综合朱莉| 99国产精品久久久久久久久久久 | 日韩视频国产视频| 精品国产乱码久久久久久闺蜜| 成人av资源站| 欧洲人成人精品| 日韩精品资源二区在线| 欧美国产日产图区| 精品日韩av一区二区| 国产欧美日韩不卡免费| 一区二区三区高清在线| 久草精品在线观看| 一本一本久久a久久精品综合麻豆| 亚洲精品一二三| 国产精品不卡在线| 婷婷国产在线综合| 国产成人99久久亚洲综合精品| 天堂久久一区二区三区| 国产精品综合二区| 欧美日韩夫妻久久| 国产精品久久久爽爽爽麻豆色哟哟 | 丰满少妇久久久久久久| 91豆麻精品91久久久久久| 欧美一级日韩不卡播放免费| 日本一区二区三区dvd视频在线| 日韩欧美在线1卡| 中文字幕在线免费不卡| 麻豆91在线播放免费| 91在线视频播放| 日韩精品最新网址|