![]() |
|
#1
|
|||
|
|||
Homework helpHi, i am new to this forum, and new to c programming. I have an assignment to write a program in c which asks the user to type in a file name (already existing) for which he wants to do processing. The size of the file is not known so memory for reading it has to be allocated dynamically. The program then looks for the 7th occurence of all phrases if they exits, of all lengths, and puts the dollar sign $$$ before and after the phrase. Then it looks for the 10th occurence of all words, and replaces it with the word "warning."
The other part of the assignment, was to design a tic tac game with spaces and words for placing and replacing. I understood this one so i did it already. I just dont understand how to proceed with the one above. Please help me out. Thanks |
|
#2
|
||||
|
||||
Re: Homework helpSo why did you post this in Misc Programming | Advertisements instead of C Programming?
__________________
Age is unimportant -- except in cheese |
|
#3
|
||||
|
||||
Re: Homework helpQuote:
Maybe for the same reason the mod didn't move it when he first saw it: carelessness. Fixed! __________________
Please read these Guidelines before posting on the forum "A person who never made a mistake never tried anything new." Einstein |
|
#4
|
|||
|
|||
Re: Homework helpI am sorry this was an error, i am new to using forums. I redirected the thread to the c programming forum.
Thanks |
|
#5
|
|||
|
|||
Re: Homework helpQuote:
Keeping the overall goals in mind , break it down to individual tasks. Create a separate function() for each task and control the program flow through main(). Work ont the project in stages and test each phase before moving on to the next. For example: task- asks the user to type in a file name (already existing) to do processing. - - - how do I get a string from a user? (print to screen for now) - - - how do I open a file? (remember you should also close the file) - - - how do I use the users input for the file name? - - - how do I store stuff from the file? ( here, think about what do you want to read , individual words? long strings? numbers) hint - You might want to start by working with very a very small file at first. - There's been a recent thread on this forum that is doing this very thing called 'seg fault' . http://www.gidforums.com/t-14811.html . . .... Check that thread for progress. ---------- task- The size of file is not known, memory for storage has to be allocated. - - - You will want to use malloc() and free() for this. ---------- ---------- Ok, so that is one major part. After having that under you belt, hat or whatever you want to put it under , move on to these next tasks. ---------- task- looks for the 7th occurence of all phrases if they exits, of all lengths, and puts the dollar sign $$$ before and after the phrase. - - - what is a 'phrase'? Oh I guess a user-provided phrase... (search and mark) - - - this will a be new challenge for me! ---------- task- Then it looks for the 10th occurence of all words, and replaces it with the word "warning." - - - is this somewhat similar to the first search above???? hmmm? - - - ditto ---------- The other part assignment, was to design a tic tac game ... i did it already. - - - good than you don't need the 'hello world' type of help...* ---------- Anyhow, take it one step at a time, you'll get there. Do what you can with the first part and get back to us when you get stumped. most of all, Have Fun doin it!, Howard; |
Recent GIDBlog
Observations of Iraq by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| DO my homework for me now | CableGuy | GIDForums™ | 12 | 13-Sep-2005 09:38 |
| Homework help | prometheus | C Programming Language | 2 | 19-Aug-2005 09:56 |
| read file into array | Requoter | C++ Forum | 9 | 28-Mar-2005 22:39 |
| C if/else statement problem | JYGUTI | C Programming Language | 1 | 28-Mar-2005 05:58 |
| C++ Homework Due Tomorrow. Help! | snatbot | C++ Forum | 3 | 02-Mar-2005 15:34 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The