error problem

no syntax errorsbut it shows up false everytime no matter what

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
34
35
36
37
#include <iostream>

using namespace std;

// password
int main()
{
	char fName[15];
	char lName[15];
	char middleInitial;
	char SSN[9];
	char startPassword[15];
	char conformation[15];

	cout << "Enter full name including middle initial respectivly: " << endl << "first name: ";
	cin >> fName;
	cout << "   last name: ";
	cin >> lName;
	cout << "   middle initial: ";
	cin >> middleInitial;
	cout << endl << "Enter Social security number: ";
	cin >> SSN;
	cout << endl << "Enter Password: ";
	cin >> startPassword;
	cout << endl;
	cout << "Enter password: ";
	cin >> conformation;
	if(startPassword == conformation)
	{
		
		cout << endl << fName << " " << middleInitial << " " << lName << " SSN: " << SSN;
	}
	else
		cout << "Wrong!";f
	system("pause");
	return 0;
}
if(startPassword == conformation)

This doesn't work with character arrays. Use an std::string.
do i need to include something for that?
#include<string>
and if you need to know how to use them:
http://www.cplusplus.com/reference/string/
or use gets(fname);

and include<stdio>

Don't ever use gets(). It allows buffer overruns and has been a major security problem in the past. And the header is either stdio.h (in C) or cstdio (in C++), never stdio.
Last edited on
Why is there an 'f'?
1
2
3
4
5
	else
		cout << "Wrong!";f
	system("pause");
	return 0;
}
Last edited on
@alexanderswang: watch your manners and be polite. This is a friendly forum.
@filipe: Sorry, got it fixed.
Topic archived. No new replies allowed.