Thread: word replacement program

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    2

    word replacement program

    hi everyone...im trying to write a program to read a text file where the first line has two words and the rest of it is a passage.the program needs to replace every occurance of the first word with the second word... this is what i have so far.. its working about 90% correct but the spacing and fullstops are off...any help would be greatly appreciated
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Dec 2011
    Posts
    795
    Use CODE tags, don't make us download stuff. Fix everything I said, and I'll help you from there.

    Don't write functions like islet() and lowercase(), just #include <ctype.h> and use those functions.

    Learn to indent your code better.

    Don't shove too much into one function.

    Don't prototype your functions in main.

    Don't use system PAUSE, it's not standard.

  3. #3
    Registered User
    Join Date
    Feb 2012
    Posts
    2
    i'm not supposed to use any functions in the <ctype.h> library for this program

  4. #4
    Registered User
    Join Date
    Jan 2009
    Posts
    1,485
    Post you code here in code tags (the little # symbol in the post editor) instead, that way we all have the same reference.

    Edit: I have looked briefly at the code, and you are suppose to have your function prototypes declared outside any functions, with global scope, not scattered all over the place, inside your functions.

    Also, no one here can actually test your code because we don't have "passage1.txt" and "output.txt".
    Last edited by Subsonics; 02-20-2012 at 01:54 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 28
    Last Post: 10-23-2011, 07:17 PM
  2. Word Counting Program
    By psv1120 in forum C Programming
    Replies: 11
    Last Post: 02-23-2011, 03:57 PM
  3. Word count program
    By Jpeg6 in forum C Programming
    Replies: 1
    Last Post: 10-18-2010, 10:34 PM
  4. Word Counting Program Help
    By rdave1 in forum C++ Programming
    Replies: 1
    Last Post: 09-14-2005, 04:30 PM
  5. word count program need a bit of help!
    By Unregistered in forum C Programming
    Replies: 7
    Last Post: 04-19-2002, 08:15 PM