Thread: help with a form letter program

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    37

    help with a form letter program

    Hey, could somebody help me out on this certain aspect of a form letter. I have a file like this:

    Dear <NAME>, I was writing you to remind you that you owe <AMOUNT> by <DATE>.....etc.

    I also have a file with the values for those symbols.

    Question is, what string function do I use to replace <SYMBOL> with the actual value??

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    27

    string search

    Use the string search to look for < then store the posistion, then start from that posistion and search for >. this gives you the string of letters that is needed. copy the string found into a temporary string, and search the file with the values for the temporary string , then replace the <whatever> with the value from the file.

    Gr3g
    Chance favors the prepared mind.

    Vis. C++ 6.0

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    589
    Does the text always have that exact format?

  4. #4
    Registered User
    Join Date
    Mar 2002
    Posts
    37
    No, the text doesn't always have the same format but the parameters that were given are:

    1. No letter variable will be used more than once in a line
    2. No line will be longer than 80 characters.

    I'm still not ultra clear on your instructions, can you try to clarify a little?

    Thanks.

  5. #5
    Registered User Sekti's Avatar
    Join Date
    Feb 2002
    Posts
    163

    couldnt you try...

    Code:
    cout<<"Dear "<<name<<" you owe us "<<amout<<" by "<<date<<endl;
    the name, amount, and date a variables just delcare them before.
    +++
    ++
    + Sekti
    ++
    +++

  6. #6
    Registered User
    Join Date
    Mar 2002
    Posts
    27

    steps

    1 open letter file
    2 read the letter file until you find a <. read all the letters after the < into a string until you find a >.
    3 open the file containing the values of the <something> search that file for the string you got in step 2. when the string is found put its value into a string
    4 go back to the oroginal file with the letter. delete the <something> statement and replace it with the string gotten in step 3
    5 repeat until no < are found


    Gr3g
    Chance favors the prepared mind.

    Vis. C++ 6.0

  7. #7
    Registered User
    Join Date
    Mar 2002
    Posts
    37
    OK Thank you, could you please tell me which function I should use to delete the <something> and replace it with the value.

  8. #8
    Registered User
    Join Date
    Mar 2002
    Posts
    27

    dontremember

    i dont rememeber, there might be a backspace ascii, but i forgot... ask someone else

    Greg
    Chance favors the prepared mind.

    Vis. C++ 6.0

  9. #9
    Registered User
    Join Date
    Mar 2002
    Posts
    37
    somebody??

  10. #10
    Registered User
    Join Date
    Mar 2002
    Posts
    37
    anybody???? Pleeeeaaaasse!!!

  11. #11
    Something Clever ginoitalo's Avatar
    Join Date
    Dec 2001
    Posts
    187
    Don't bump your post

    ---I wish this message didn't bump it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Login Form for program
    By Houssen in forum C++ Programming
    Replies: 3
    Last Post: 03-29-2008, 02:35 PM
  2. Advice requested, Code makes sense to me, not compiler
    By andrew.bolster in forum C Programming
    Replies: 53
    Last Post: 01-06-2008, 01:44 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. simple frontend program problem
    By gandalf_bar in forum Linux Programming
    Replies: 16
    Last Post: 04-22-2004, 06:33 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM