GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 27-Jun-2007, 03:40
Fusina Fusina is offline
New Member
 
Join Date: Jun 2007
Posts: 4
Fusina is on a distinguished road

Homework help


Hi, 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  
Old 28-Jun-2007, 00:45
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,243
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: Homework help


So why did you post this in Misc Programming | Advertisements instead of C Programming?
__________________

Age is unimportant -- except in cheese
  #3  
Old 28-Jun-2007, 10:35
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 893
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough

Re: Homework help


Quote:
Originally Posted by WaltP
So why did you post this in Misc Programming | Advertisements instead of C Programming?

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  
Old 29-Jun-2007, 06:53
Fusina Fusina is offline
New Member
 
Join Date: Jun 2007
Posts: 4
Fusina is on a distinguished road

Re: Homework help


I am sorry this was an error, i am new to using forums. I redirected the thread to the c programming forum.
Thanks
  #5  
Old 29-Jun-2007, 09:56
Howard_L Howard_L is offline
Regular Member
 
Join Date: Apr 2007
Location: Maryland/PA, USA
Posts: 470
Howard_L has a spectacular aura aboutHoward_L has a spectacular aura about

Re: Homework help


Quote:
Hi, i am new to c programming.... I just dont understand how to proceed ....
Looks like you have a good start right there!
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 GIDBlogObservations of Iraq by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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

All times are GMT -6. The time now is 06:23.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.