Hi. I am making a program, and I have a main section and a class that the main section tefers to in a .h file. The Ifstream part wont work, and i dont know why. Please help.
MAIN:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <fstream>
using namespace std;
#include "logInInterface.h"
#include "displayCopyright.h"
#include "gatherUserData.h"
// Prototype decelarations
int passwordIn();
// Declare global variables
copyrightMessage ds;
int main(int nNumberofArgs, char* pszArgs[])
{
// Clear the screen
system("CLS");
passwordIn();
// After logInFunc form logInInterface.h is done, start the next action
system("CLS");
ds.displayCopyright();
// Now ask the user to enter his/her library card number
string inputNumber;
cout << "\nPlease enter your library card number: ";
cin >> inputNumber;
userData uD;
uD.displayData(inputNumber);
system("PAUSE");
return 0;
}
int passwordIn()
{
system("CLS");
ds.displayCopyright();
logIn a;
string passwordInput;
cout << "\nPlease enter the password: ";
cin >> passwordInput;
a.logInFunc(passwordInput);
if (a.statusInt == 0)
{
passwordIn();
}
return false;
}
gatherUserData.h
class userData
{
public:
userData()
{
number = "0";
}
// Start a function that is able to display all of the user's data
int displayData(string number)
{
userFound = false;
ifstream displayData2;
displayData2.open("userInformation.database.txt");
while (displayData2 >> tempData)
{
<< number
<< "\n";
if (tempData == number)
{
userFound = true;
// Now get the name
displayData2 >> name;
cout << "\n\nName: "
<< name
<< "\n";
// Now say the number
cout << "Library Card Number: "
// Now get the first part of expiration date
displayData2 >> exp1;
cout << "Expiration date: "
<< exp1;
// Now get the second part
displayData2 >> exp2;
cout << " "
<< exp2;
// Now the third
displayData2 >> exp3;
cout << " "
<< exp3
<< "\n";
}
displayData2.close();
}
return false;
}
private:
string number;
string name;
string exp1;
string exp2;
string exp3;
string phone;
string email;
string pin;
string fine;
string out;
string holdType;
string holds;
string availibleHolds;
string tempData;
bool userFound;
};
Any help GREATLY appreciated