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++)
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
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.