help with strings...kind of tedious work I need help on.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: help with strings...kind of tedious work I need help on.

  1. #1
    Join Date
    Apr 2008
    Posts
    1

    help with strings...kind of tedious work I need help on.

    Me and my partner attempted this and didn't get real far with the program. We need to use strings and string functions. Also, loops. I will try to explain it and show the code we have got.

    I have 2 documents named Emma and Letter. The file contained Emma has a lot of introductory material which I need to skip. Easiest way is to hunt for the string "Chapter I". Then start with file position marker on the first line. The way this works is with groups of 3 words from letter.txt. The first word says how many lines you need to move down in the text by the number of letters in the words. Second word tells you the word on that line by the number of letters in the word. Third word, use the length of the word to find the particular letter. Repeat thus until the letter or character found is a period(.). The output should be "timeisimportant"

    Example, the letter.txt document starts like this:

    Hi cousin,

    I might be at school with you soon............

    So you would use Hi, cousin and I as first, second, and third word. And use the directions for the words in Emma to find each letter. And keep repeating.

    code I have so far which is not much:
    Code:
    #include <iostream>
    #include <fstream>
    #include <string>
    
    
    
    using namespace std;
    
    int main()
    {
        ifstream inputFile;
        ifstream input;
        
        string a, w, x, z;
        a = "CHAPTER I";
        
    
        inputFile.open("Emma.txt"); // opens the txt file
        input.open("Letter.txt");
    
        while (w != a)
            getline(inputFile, a);
    
        while (!input.eof())
            getline(input, z);
    
        input >>  ;
        
            
    
    
        return 0;
    }
    i have tried other forums with not much help at all.

  2. #2
    Join Date
    May 2007
    Posts
    843
    I don't understand what u mentioned here.

Similar Threads

  1. Data Entry Work
    By Anjana Jonathan in forum Careers
    Replies: 5
    Last Post: 07-03-2006, 03:15 AM
  2. Replies: 0
    Last Post: 10-15-2001, 07:52 PM
  3. Work at home options in IT field
    By Shaheen in forum Careers
    Replies: 2
    Last Post: 01-17-2001, 11:19 AM
  4. Justification for tele-commuting
    By Jason Langston in forum Careers
    Replies: 10
    Last Post: 08-08-2000, 08:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center