EssayGhost Assignment代写,Essay代写,网课代修,Quiz代考

EssayGhost-Essay代写,作业代写,网课代修代上,cs代写代考

一站式网课代修,论文代写

高质量的Assignment代写、Paper代写、Report代写服务

EG1hao
网课代修代上,cs代写代考
C++代做
您的位置: 主页 > 编程案例 > C++代做 >
代做C++/C:c代码代写 CIS 212: Project #3C - C++代做
发布时间:2021-07-25 22:53:10浏览次数:
CIS 212: Project #3CAssigned: Tuesday November 13th, 2018 Due Tuesday, November 20th, 2018(which means submitted by 6am on November 21st, 2018) Worth 4% of your gradePlease read this entire prompt! c代码代写As per usual, I encourage you to tackle this project in small pieces.. The worst approach to programming is to write a ton of code, compile it, and then run and watch it fail … it is so hard to debug. Instead, break the problem up into sub- problems, compile frequently, and test frequently.The final goal of this project is to match up heart donors with heart recipients. This will be done with the queue data structure, and you must use queues. In the real world, I imagine there are a lot of restrictions about matching up donors and recipients. For this toy problem, we will assume that any woman can donate a heart to any other woman, and any man can donate a heart to any other man.The file “3C_input” contains a sequence of events. Note that I expect the filename to be an input to your program; you should look for argv[1] and not hardcode “3C_input” as the filename. (check_3C ensures this through some trickery – take a look.) Also, please keep in mind that if you are running gdb with a command line argument, you need to do something special. See appendix below.The very first line is “R:F:Madie Koening.” This means the first event is that (person) Madie Koening, a female (F), needs to receive a heart (R).The second line is “H:Sacre Couer.” This means that the second event is that the hospital (H) named “Sacre Couer” is available to do a surgery.The third line is “D:F:Susie Brown.” This means that the third event is that (person) Susie Brown, a female (F), can donate a heart (D).This is enough to do a transplant. We have a female donor, a female recipient, and a hospital. So your program should issue a match.Your program would then go through the rest of the events in the input file. For each new event, your program should make a match right then, if it can.Note there is an ambiguous case: assume we have a female donor and a female recipient, and also a male donor and a male recipient, but no hospital. Then assume we get a hospital event. The question is whether to do the surgery for the female or male. In this case, the rule is “ladies first.”Like the real world, the sooner you ask for a heart, the sooner you will get one. So if person A appears in the list before person B (and if A and B are the same gender), then A will receive a heart before B (or donate their heart before B).Obviously, queues are a great data structure for this, as they are a mechanism for placing people in lines. Also, again, you must use queues.Hint #1: you will need five queues to make this work. If you look in the starter code, you can see the names of my five queues.Hint #2: you should break this up into three steps.Step #1: implement a queue data structure, and methods to work on that queue. There is commented out code in the main function of the starter code (labeled Step #1) for testing your queue code. (Note: you must implement this yourself. I don’t want anyone using implementations from other libraries.)IMPORTANT: in lecture #15, I show a queue implementation that has O(n) dequeue time. I DON’T want that version. INSTEAD, I want the O(1) version that has front/back. (You must do O(1) version, and will be penalized if you do the O(n) version.)Step #2: read the events from the file. There are slides in Tuesday’s lecture on fgets. That is the easiest way to do it. That said, keep in mind that you need to be allocating memory for each new line. In my solution, I wrote a function called “NewString” that did this allocation. It also removes the newline that fgets leaves in. I put NewString in my starter code, and you are welcome to use it. Note that the memory allocated by NewString will be leaked, and that is OK.Step #3: implement the matching described above. You can make the following assumptions in parsing:The first character of a line can only be R, H, orThe second character is always acolonIf the event is a hospital, then the third character is the beginning of the hospital name.If the event is a recipient or donor, then the third character is always M or F, the fourth character is always a colon, and the fifth character is thebeginning of the person’s== Success ==Before you submit, make sure to test your code using the provided grader program script (check_3C) on the Virtual Box.Upload your new file, proj3C.c== Running gdb with a command line argument ==Remember! … this will not have the intended effect: gdb a.out 3C_inputIn this case, gdb will assume 3C_input is an argument to gdb. It will look at the argument, decide it is worthless, and discard it.Instead, you want to do this: (shell prompt:) gdb a.out (gdb prompt:) run 3C_inputThis will successfully pass the argument to your program as you run.Otherwise, you will likely have a NULL argument for argv[1], and so your fopen will fail, and then you will end up debugging why fopen fails with a NULL filename … which is not the same problem you have outside gdb.最先出自315代写  C代写合作:315代写

所有的编程代写范围:essayghost为美国、加拿大、英国、澳洲的留学生提供C语言代写、代写C语言、C语言代做、代做C语言、数据库代写、代写数据库、数据库代做、代做数据库、Web作业代写、代写Web作业、Web作业代做、代做Web作业、Java代写、代写Java、Java代做、代做Java、Python代写、代写Python、Python代做、代做Python、C/C++代写、代写C/C++、C/C++代做、代做C/C++、数据结构代写、代写数据结构、数据结构代做、代做数据结构等留学生编程作业代写服务。