marpis
2008-12-03 15:22:35
What is wrong with the if- statement? Even if i wrote laura as FirstName, it doesn't print "I knew its you". Google didn't help me at all
#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
char FirstName[30], LastName[30];
int Age;
char FileName[20];
cout << "First name:";
cin >> FirstName;
if (FirstName == "laura")
{
cout << "I knew it's you!" << endl;
}
cout << "Surname: ";
cin >> LastName;
cout << "Age:";
cin >> Age;
cout << "\nFilename (remember .txt) ";
cin >> FileName;
ofstream Students(FileName, ios::out);
Students << FirstName << "\n" << LastName << "\n" << Age;
cout << "\n\n";
return 0;
system("PAUSE");
return EXIT_SUCCESS;
}