Two simple errors I cannot figure out!
I'm getting two errors currently in my code.
Error: 'string' was not declared in this scope.
Error: 'titleDisplay' was not declared in this scope.
The following is my code. Any ideas?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#include <iostream>
#include <fstream>
#include <string>
#include "Title.cpp"
void titleDisplay(string);
using namespace std;
int main()
{
string title;
titleDisplay(title);
}
// Function name: Title
// Purpose: to display title
void titleDisplay(string title)
{
fstream fin;
fin.open("Title.txt");
while (!fin.eof())
{
getline(fin,title);
}
cout << title;
}
|
You should place directive
using namespace std;
before the declaration of function
void titleDisplay(string);
or write the function declaration as
void titleDisplay(std::string);
Thanks for solving me headache sir =) Happy holidays!
Topic archived. No new replies allowed.