Thread: Student Question

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    14

    Student Question

    I am SO stuck it's ridiculous!

    I am trying to write a program that uses a "while" loop and finds the '@' in a .dat file and pulls the full e-mail address and outputs it to another file.

    the "find" function is really giving me problems. I can open the data file, I can send the data to the output file, but for the life of me, I cannot figure out how to find and pull the e-mail strings out of the data file.

    Can you guys please point me in the right direction....I'm already late with this assigment.

    What's bad...I've been breezing through until this point. I can do some PHP and I've already been through VB, so I can't understand why I am just missing the concept of this entirely!!

    Thanks!!

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Seriously, are teachers passing this website URL out in class?

    http://cboard.cprogramming.com/showthread.php?t=76187
    Sent from my iPadŽ

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    but for the life of me, I cannot figure out how to find and pull the e-mail strings out of the data file.
    1) Read in a line of data from your input file into a string type variable
    2) Use find() to locate the index position of @ in the string variable.
    3) Step backwards through the string until the start of the email address and record that index value.
    4) Step forwards through the string until the end of the email address and record that index value.
    5) Use substr() to get the substring between those two index values.
    6) Write the email address to the output file.
    7) Start at the end of the email address and continue searching the string for the next '@' character using find().
    8) Go to 1.
    Last edited by 7stud; 02-26-2006 at 09:26 PM.

  4. #4
    Registered User
    Join Date
    Feb 2006
    Posts
    14
    Well, this is close to what I want. However, that's a bit more than I am trying to do.

    I don't want code, I want someone to explain to me how I can "find" the @ symbol in the data file and pull the WHOLE string into an output file. That is what I don't understand.

    And no, they don't send us this way. Us poor online students get a text book and a list of assignments in my college and that's it. Therefore, if we need an explanation or an understanding, we have to go look for it ourselves.

    I figured this would be a good place to ask since you are all so well versed in this programming language.

  5. #5
    Registered User
    Join Date
    Feb 2006
    Posts
    14
    Thanks 7stud...I think that explains it a bit better. I can lookup the code for that.

    Thanks again!!!!!!!!!!!

  6. #6
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    I was being more humorous than serious. It always seems that these assignment questions tend to come in pairs or triplets around these forums.

    I also didn't paste that link so you could see the code, infact I forgot it was there. I just posted it to show you that your exact question had just been asked.
    Sent from my iPadŽ

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 12:14 PM
  2. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  3. a question on pointers, structs and arrays
    By onefootswill in forum C Programming
    Replies: 3
    Last Post: 12-06-2007, 01:27 AM
  4. student question
    By student2005 in forum C++ Programming
    Replies: 6
    Last Post: 10-12-2003, 11:28 PM
  5. what does this warningmean???
    By kreyes in forum C Programming
    Replies: 5
    Last Post: 03-04-2002, 07:53 AM