Thread: Need help plz experts or someone

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    11

    Need help plz experts or someone

    here is instructions:

    File Processing

    Make a Mad Libs party game. The leader has the text of a short story with a few missing words in it. The missing words are tagged by their function [noun], [verb], [place], etc... For example:

    It was a [adjective] summer day.
    Jack was sitting in a [place].

    The leader examines the text and prompts the players for the missing words:

    Please give me a/an:
    adjective
    place
    etc...

    He then reads the text with the supplied words inserted into their places.

    Write a program that acts as the Mad Libs leader. It should prompt the user for a file name (or display a menu of available files), read the text from the chosen file, find the tags for the missing words, prompt the user for the words, and, finally, find the completed text in another file. You MUST use apstring, and, at least 2 funstions. In addition, use the <fstream.h> header file for the class ifstream. You will need to use the open, close, eof, and fail functions.

    The files that i use will include the following: Holdiday, Noun, Verb, Food, Person, Adjective. All words tagged by [ ].






    Code:
    #include<iostream>
    #include<iomanip>
    #include<fstream>
    #include"vector"
    #include"string"
    using namespace std;
    
    
    //Mad Lib
    //Daniel Meade
    
    
    int main()
    {
     ifstream fin;
     ofstream fout;
     string filename, line;
     char temp;
    
    
     do
     {
      fin.clear();
      cout << "What is the file name";
      getline(cin, filename);
      fin.open((filename).c_str());
      if(fin.fail())
       cout << "Not valid file." << endl;
      }while(fin.fail());
    
      while(!fin.eof())
      {
       vector<string>story(19,"");
       vector<string>word(18,"");
    
    
       getline(fin,line);
       if(line.find('[') == 1)
       {
        if(int x=0; x<=18; x++)
         line = word[x];
       }
       else
       {
        if(int y=0; y<=18; y++)
         cout << "enter a word" << word[x] <<":"<< endl;
         cin >> word [x];
       }
       if(int y=0; y<=18; y++)
       {
        cout << story[y];
        if(int x=0; x<=18; x++)
         cout << word[c];
       }
    
      }
      fin.close();
     }
    
     }
    file input

    TWas the night before
    [Holday]
    and all through the
    [Noun],
    not a
    [Noun]
    was
    [Verb]
    ,not even a
    [Noun].
    All the children were tucked all snug in their
    [Noun],
    with visions of
    [Food]
    dancing in their heads.The stockings were hung by the chimney with
    [Verb],
    in hopes that
    [Person]
    soon would be there.I in my kerchief and ma in her
    [Noun],
    had just
    [Verb]
    down for a
    [Adjective]
    winter's nap.When up on the roof on I
    [Verb]
    such a
    [Adjective]
    ,I jumped from my bed to
    [Verb]
    what was the matter.When what do my
    [Adjective]
    eyes do appear,but a
    [Noun]
    and eight
    [Adjective]
    reindeer.

    Errors:

    parse error before ';' token on a bunch of lines what does this mean?
    Last edited by cplusplus12; 02-06-2006 at 07:55 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can any1 plz make this assignment
    By jean in forum C Programming
    Replies: 17
    Last Post: 05-13-2009, 09:19 PM
  2. [Request] Need Help Plz
    By TylerD in forum Tech Board
    Replies: 4
    Last Post: 01-03-2009, 09:54 AM
  3. check out this tutorial plz...even experts
    By KidMan in forum C Programming
    Replies: 1
    Last Post: 01-28-2006, 11:15 AM
  4. Anyone plz help me
    By Rose_Flowers in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 09-17-2003, 12:01 PM
  5. help plz plz
    By nsssn73 in forum C++ Programming
    Replies: 2
    Last Post: 06-03-2002, 08:44 AM