![]() |
|
#1
|
|||
|
|||
Suggestions for my Code for Hangman /* Ansi C-based */It is a single player hangman that uses text files to read phrases that will be used for the game and can /* store top 5 players in a text file */ and uses functions and a library for other utilities.
This is the main.c CPP / C++ / C Code:
This is the util.h CPP / C++ / C Code:
Please appologize if there are several mistakes in my program. It is currently under development. But that is the main program. My main objectives are to: 1. Have random praise or insult. /* Implemented */ 2. Case insensitive character checking. /* Implemented */ 3. Save the top 5 players in a seperate file. /* Under Debug */ 4. Encrypton/ Decryption Scheme. /* Alpha Stage */ 5. Use comments so the phrase will not be repeated. /* Not yet done. */ 6. Use srand() to change the sequence of rand(). /* Implemented */ Suggestions, comments, additional codes, improvements is very much needed. Thanks. ![]() /* Note: For students whose from UPLB, please no plagiarizing, and if you want to use some of my algo, please cite my complete name in your documentation. */ |
|||
|
#2
|
|||
|
|||
Re: Suggestions for my Code for Hangman /* Ansi C-based */All I did was make it so that your code would compile cleanly without errors. There are still numerous warnings. Here is the code:
util.h CPP / C++ / C Code:
...and your "main" file, that I called hangman.c: CPP / C++ / C Code:
...and the compiler warnings: Code:
You've got globals, multiple statements on single lines, multiple variables declared on single lines, no return values for functions declared to return a value, you use single-line and multi-line conditional braces, in some cases you jam your variables and operators together and in others you separate them with appropriate whitespace, you were missing headers and inclusion guards...give it a bit more work and clean it up and we'll take another look at it, okay? :davis: |
|
#3
|
|||
|
|||
Re: Suggestions for my Code for Hangman /* Ansi C-based */Well, thanks man..
Err.. I have managed to clean it up and im down with the problem of how to restate an argument like this? CPP / C++ / C Code:
|
|
#4
|
|||
|
|||
Re: Suggestions for my Code for Hangman /* Ansi C-based */Ive now encountered my second problem in decypting a text file. I managed to encrypt it by changing each character to it hex equivalent and decrypting it is successful. The problem is it doesnt have any newlines. So the multi-lined source file becomes a single line source file!
Encryption.c CPP / C++ / C Code:
Decryption.c CPP / C++ / C Code:
So a file with: // Hello // world is encypted as: // 68 65 6c 6c 6f // 77 6f 72 6c 64 and decrypted as: // helloworld I want an expected output of: // hello // world Any one? |
|
#5
|
|||
|
|||
Re: Suggestions for my Code for Hangman /* Ansi C-based */After cont's debugging, problem solved.
|
|
#6
|
|||
|
|||
Re: Suggestions for my Code for Hangman /* Ansi C-based */To prevent plagiarized codes, can the admin please erase my C codes? Because this hangman was assigned to be a project individually. Im afraid that someone can gain access to this codes with simple searches on google.
Ive done one and this thread showed on page 3. ! |
|
#7
|
||||
|
||||
Re: Suggestions for my Code for Hangman /* Ansi C-based */Unfortunately, I cannot delete the code. I am not obliged to do so.
Quote:
This is why we exist... So (other) people can find things already being discussed and shared. We cannot control what people do with the information they find here. This may be obvious but I'll state it again -- please refrain from posting or replying if you don't want certain information to be shared with others. As far as I am concerned, you already did the responsible thing by suggesting / advising people what they can and cannot do with your code examples inside this thread. |
|
#8
|
|||
|
|||
Re: Suggestions for my Code for Hangman /* Ansi C-based */I realized that after posting the last post.
BTW, thanks. __________________
[ http://www.komsay-elbi.tk/ ] [ http://www.abovetopsecret.com/ ] |
Recent GIDBlog
Problems with the Navy (Officers) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Code Contest | Paramesh | Miscellaneous Programming Forum | 76 | 30-Jun-2006 13:18 |
| User defined headers | davis | Miscellaneous Programming Forum | 6 | 16-Feb-2006 19:40 |
| Guidelines for posting requests for help - UPDATED! | WaltP | C++ Forum | 0 | 21-Apr-2005 03:44 |
| Problem with int mixed with char,... | leitz | C++ Forum | 17 | 07-Dec-2004 21:56 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The