Hey guys: I have a quiestion from Programming and Problem, Solving with C++: Bre
ID: 3621322 • Letter: H
Question
Hey guys: I have a quiestion from Programming and Problem, Solving with C++: Breif Edition (5th) and was wondering if you could just help me get started with some of the pseudocode I need to build the program.Thanks,
Daniel
You need to build a program that reads a file input.dat and that outputs every string containging the '@' sign to file output.dat. For the purposes if this program, a string is defined as it is by the C++ stream reader -- a contiguous sequence of non-whitespace characters.
Given the data:
From: sharon@marzipan.edu
Date: Wed, 13 Aug 2003 17:12:33 EDT
Subject: Re: hi
To: john@meringue.com
John,
Dave's email is dave_smith@icing.org
ttyl,
sharon
The program would output the following in 'output.dat':
sharon@marzipan.edu
john@meringue.com
dave_smith@icing.org
Explanation / Answer
If you'd just like pseudocode, this should do it. Let me know if you have any questions. Please rate. Thanks! :) // -- will be used for indentation because Cramster does not like whitespace // Main program loop - reads file, checks each word for the @ character, sends the strings that contain @ to the output (either a file or standard output) PROGRAM_LOOP() s = next string in file while not end of file --if CONTAINS@(s) ----send s to output --s = next string in file // Checks a string for whether or not it contains the @ sign. CONTAINS@(string s) n = s.length for i = 0 to n --if s[i] == '@' ----return true return false