代写CS 2400作业、代做C++程序语言作业、代写C++实验作业、代做line arguments作业代做Database|帮做Haskell程序

CS 2400 HW 5, Card Game (40 Points) Due: Monday April 1, 2019Objectives:Use arrays, random number generators, command line arguments.This card game requires a certain number of cards, n, where n is a triangular number. Atriangular number is a number that represent the sum of a sequence: 1, 2, 3, 4, etc. Forexample, 21 = 1 + 2 + 3 + 4 + 5 + 6. The first few triangular numbers are 1, 3,6, 15, 21, 28, 36, 45, etc.The Game:You will start the game with an n value (default 45) for the number of cards. Divide the cardsinto a random number of piles.Playing the game (Assuming n = 45):Each round, take one card from each pile and create a new pile. Repeat the process until youhave 9 piles of sizes 1, 2, 3, 4, 5, 6, 7, 8, and 9.For example, if you start with 4 piles of 20, 15, 6, and 4, they would be transformed into19, 14, 5, 3, and 4, etc.Simulator:Write a C++ program that simulates the game. Your program must obtain the number of cards(n) from the command line (see below). Assume the number of cards will never exceed 500. Ifthe number is not provided, then use 45 as the default value of n. If the user, enters morethan one value, print an error message and quit the program (return 0).Start by producing a random number of piles. Make sure the total is n. Apply the stepsoutlined above repeatedly until the final configuration is reached. At each step, print thenumber of cards in each of the piles. The final configuration is reached when the number ofcards in the piles are in sequence: 1, 2, 3, 4, 5, 6, 7, etc. Display the number ofsteps it took to reach the final configuration.CS 2400 HW 5, Card Game (40 Points) Due: Monday April 1, 2019Hints: Store the number of cards in each pile into an array of integers. Write a function (isTriangular) that returns true if a number n is a triangularnumber, false otherwise. To generate a random number use the function rand()in o First seed the random number generator with the current time. Do this onlyonce in the program (beginning of main)§ srand(time(NULL));o To generate a random integer between 0 and 2147483647§ randomInteger = rand(); Write a function to print all the elements of the array Write a function that checks if the game is done by confirming the last sequence. Youmay want to sort the values to make it easier to check. To convert a string to an integer, use atoi() function. For example,number = atoi(st);Parsing command line argumentsIn C++ you can input data (strings) into your program on the command line (command linearguments). You can capture these data by adding two parameters to your main program asfollows:int main (int argc, char *argv[])argc: (argument count) number of arguments on the line, including the name of theprogramargv: (argument vector) list of c-style strings that represent all the argumentsincluding the name of the program (two dimensional array of characters).For example, executing the command:./a.out 45Assigns:argc = 2argv[0] will be ./a.outargv[1] will be 45CS 2400 HW 5, Card Game (40 Points) Due: Monday April 1, 2019Sample output (n = 45):./a.out 5Error: the number 5 is not a triangular number./a.out 5 7Error: too many parameters../a.out 10number of cards: 108 27 2 16 3 15 3 24 3 2 1Number of rounds: 5./a.out34 7 3 133 6 4 232 5 4 3 131 5 4 3 2……11 8 7 6 5 4 3 110 8 7 6 5 4 3 29 8 7 6 5 4 3 2 1----------------------------------------------------------------Number of rounds: 28Grading:Programs that contain syntax errors will earn zero points.Programs that do not include functions will also earn zero points.Programs that use global variables other than constants will earn zero points.Your grade will be determine using the following criteria: Correctness (35 points)o (7 points) Parsing the command line arguments and printing error messageso (7 points) Verifying the number of cards is triangularo (7 points) The initial number of cards in each pile is selected randomlyo (3 points) The number of cards in each pile is printed repeatedlyo (4 points) The number of rounds is printedo (7 points) Clarity and format of the output Style & Documentation (5 points)Follow the coding style outline on GitHub:https://github.com/nasseef/cs2400/blob/master/docs/coding-style.md本团队核心人员组成主要包括BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:[email protected] 微信:codehelp

你可能感兴趣的:(代写CS 2400作业、代做C++程序语言作业、代写C++实验作业、代做line arguments作业代做Database|帮做Haskell程序)