PLEASE HELP

I'm writing a program that reads txt file that has a mad libs story in it like this and it wont compile I was wondering if anyone knows how to help!

Zoos are places where wild <plural_noun> are kept in pens or cages <#> so
that <plural_noun> can come and look at them. There is a zoo <#> in the park
beside the <type_of_liquid> fountain . When it is feeding time , <#> all
the animals make <adjective> noises . The elephant goes <{> <funny_noise>
<}> <#> and the turtledoves go <{> <another_funny_noise> . <}> My favorite
animal is the <#> <adjective> <animal> , so fast it can outrun a/an
<another_animal> . <#> You never know what you will find at the zoo. <#>

Where

# Newline character means No space before or after.
{ Open double quotes means Space before but not after.
} Close double quotes means Space after but not before.
[ Open single quote means Space before but not after.
] Close single quote means Space after but not before.
anything else A prompt

this is what the program is suppose to look like.

Please enter the filename of the Mad Lib: madlibZoo.txt
Plural noun: boys
Plural noun: girls
Type of liquid: lemonade
Adjective: fuzzy
Funny noise: squeak
Another funny noise: snort
Adjective: hungry
Animal: mouse
Another animal: blue-fin tuna
Zoos are places where wild boys are kept in pens or cages
so that girls can come and look at them. There is a zoo
in the park beside the lemonade fountain. When it is feeding time,
all the animals make fuzzy noises. The elephant goes "squeak"
and the turtledoves go "snort." My favorite animal is the
hungry mouse, so fast it can outrun a/an blue-fin tuna.
You never know what you will find at the zoo.
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstring>

using namespace std;

void getFileName(char fileName[])
{
cout << "Please enter the filename of the Mad Lib: ";
cin.getline(fileName, 256);
}

/*************************************************************
*
*
**************************************************************/
int readMadLib(char fileName[], char madLib[][32])
{
ifstream inStream(fileName);

if (!inStream.fail())
{
int i = 0;
while (inStream >> madLib[i])
{
i++;
}
inStream.close();
return i;
}
return 0;
}

/*************************************************************
*
*
**************************************************************/
bool isBrackets(char madLib[][32], int numWords)
{
return (madLib[numWords][0] == '<' &&
madLib[numWords][strlen(madLib[numWords]) - 1] == '>');
}

/*************************************************************
*
*
**************************************************************/
void getMadLibPrompt(char madLib[][32], int i)
{

char prompt[256];


for(int j = 0; j < 32; j++)
{
if (madLib[i][j] == '_')
madLib[i][j] = ' ';

else if (madLib[i][j] == '>')
madLib[i][j] = '\0';
}
madLib[i][1] = toupper(madLib[i][1]);

for(int j = 0;j < 32; j++)
{
prompt[j] = madLib[i][j + 1];
}

cout << " \t";
cout << prompt;
cout << ": ";
cin.getline(madLib[i], 256);


}

/*************************************************************
*
*
**************************************************************/
void commandsAndPrompts(char madLib[][32], int numWords)
{
for (int i = 0; i < (int)numWords; i++)
{
if (isBrackets(madLib, i))
{
switch (madLib[i][1])
{

case '#':
strcpy(madLib[i], "\n");
break;


case '{':
strcpy(madLib[i], " \"");
break;

case '}':
strcpy(madLib[i], "\"");
break;

case '[':
strcpy(madLib[i], " \'");
break;

case ']':
strcpy(madLib[i], "\'");
break;

default:
getMadLibPrompt(madLib, i);
break;
}
}
}
}

/*************************************************************
*
*
**************************************************************/
void setSpaces(char madLib[][32])
{
// vector <char> quoteAndTickPushBack;
for (int i = 0; i < char madLib[][32]; i++)
{
if (madLib[i][0] == '\n');
else if (madLib[i][1] == '"' || madLib[i][1] == '\'')
{
if (madLib[i - 1][0] == '"')
{
quoteAndTickPushBack.clear();
quoteAndTickPushBack.push_back('"');
madLib[i - 1] = quoteAndTickPushBack;
}

else if (madLib[i - 1][0] == '\'')
{
quoteAndTickPushBack.clear();
quoteAndTickPushBack.push_back('\'');
madLib[i - 1] = quoteAndTickPushBack;
}
}

else
{
switch((madLib[i + 1][0]))
{
case '\n':
case '"':
case '!':
case ' ':
case '\'':
case ')':
case ',':
case '.':
case ';':
case '?':
case ']':
case '`':
case '}':
break;
default:
madLib[i].push_back(' ');
}
}
}
}
/*************************************************************
*
*
**************************************************************/
void display(char madLib[][32],int numWords)
{
cout << endl;
for (int i = 0; i < numWords; i++)

cout << madLib[i];
}

/*************************************************************
*
*
**************************************************************/
int main()
{
char ans;

do
{
char madLib[1024][32];
char fileName[256];


getFileName(fileName); //good
int numWords = readMadLib(fileName, madLib); //good
commandsAndPrompts(madLib, numWords);
// setSpaces(madLib);
display(madLib, numWords);

char question[] = "Do you want to play again (y/n)? ";
cout << question;
cin >> ans;
cin.ignore();
}
while (ans == 'y');
cout << "Thanks for playing.\n";
return 0;
}
Format your msg with code tags pls
Topic archived. No new replies allowed.