Need help with errors

I have this project due by tonight. I need help figuring out where these errors are.

#include <iostream>
using namespace std;

/**********************************************************************
* Add text here to describe what the function "main" does. Also don't forget
* to fill this out with meaningful text or YOU WILL LOSE POINTS.
***********************************************************************/
void getFileName(char fileName[])
{
cout << "Please enter the filename of the Mad Lib: ";
cin >> fileName;

}

int readFile(char fileName, char text)
{
std::ifstream fin (fileName);
if (fin.fail())
return 0;
}
{
int i = 0;
int numText = 0;
while(fin >> text[numText])
{

numText++;

}

fin.close();
return numText;
}

void askQuestion (char text, int numText)
{
for (int i =0; i < numText; i++)
{
if (text[i][0] == '<')
{
if (text[i] == '#')
{
text[i][0] = '\n';
}
else if (text[] == '{')
{
clearWord(text,i)
text[i][0] = ' ';
}
else if (text[] == '}')
{
clearWord(text,i)
text[i][0] = '\"';
text[i][1] = ' ';
}
else if (text[] == '[')
{
clearWord(text,i)
text[i][0] = ' ';
text[i][1] = '\'';
}
else if (text[] == ']')
{
clearWord(text,i)
text[i][0] = '\'';
text[i][1] = ' ';
}
else
for (int phraseWord = 1; text[i][phraseWord]; phraseWord++)

{
if (phraseWord == 1)
cout << "\t" << (char)(toupper(text[i][1]));
else if (text[i][phraseWord] == '_')
cout << " ";
else if (text[i][phraseWord] == '>')
cout << "";
else if (phraseWord != 1)
cout << text[i][phraseWord];
}
cout << ": ";
cin.getline(text[i], 32);
}
}
}

int main()
{

char fileName[256];
getFileName(fileName);
char text[256][32];
int numText = readFile(fileName, text);
askQuestion(text, numText);

return 0;
}

here are the errors

project09.cpp: In function ‘int readFile(char, char)’:
project09.cpp:35: error: variable ‘std::ifstream fin’ has initializer but incomplete type
project09.cpp: At global scope:
project09.cpp:39: error: expected unqualified-id before ‘{’ token

Any help would be appreciated.
Pretty sure you have errors at line 35 and 39 :

35 says 'variable std::ifstream fin' has initializer but incomplete type' : I think you may be missing your #include <fstream>, which is where all the files manipulation methods comes from.

At 39, it says you are missing a '{', so you should relook all of those and make sure you have the correct amount and that the scopes are correct.
Last edited on
Thank you. I got it all figured out. Viiarge your comment was super helpful.
Good luck on the rest ! Sorry for engrish :P
Topic archived. No new replies allowed.