unable to input data

Whats wrong with my code, I wasn't able to input for Lastname field. Can somebody please take a look at this. Any help would be so much appreciated. Thanks Guys.
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include <iostream.h>
#include <windows.h>

HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE); // For gotoXY() function
COORD CursorPosition;

void cls(); //prototype
void setcursor(int x, int y); //prototype

//process or payroll system
int display_header(); //prototype

char fname, lname;

int display_header()
{
	cls();
	cout << "\n\n";
	cout << "     *****                                                                     " << endl;
	cout << "     ******    *   **   ** ** ***  ****** **     **                            " << endl;
	cout << "     **  ***  ***   ** **  ***  ** **  ** **     **                  ****      " << endl;
	cout << "     ******  *   *   ***   **   ** **  ** **     **           -by-   ** **     " << endl;
	cout << "     *****  *******  **    **      **  ** **     **                  ****      " << endl;
	cout << "     **     **   ** **     **      ****** ****** ******                        " << endl;
	cout << "     **                                                                        \n" << endl;
	cout << "===============================================================================" << endl;
	cout << "\n\n";

	return 0;
}


main()
{
mainmenu:
	char main_sel;
	display_header();
	cout << "**_________________________________ M A I N _________________________________**" << endl;
	cout << "                                                                               " << endl;
	cout << "                     ||                                 ||                     " << endl;
	cout << "                     ||  [1] Enroll                     ||                     " << endl;
	cout << "                     ||                                 ||                     " << endl;
	cout << "                     ||  [2] Inquiry                    ||                     " << endl;
	cout << "                     ||                                 ||                     " << endl;
	cout << "                     ||  [3] Compute Salary             ||                     " << endl;
	cout << "                     ||                                 ||                     " << endl;
	cout << "                     ||  [x] Exit Program               ||                     " << endl;
	cout << "                     ||                                 ||                     " << endl;
	cout << "                                                                               " << endl;
	cout << "                                                                               " << endl;
	cout << "                        Please select a process : ";
	cin >> main_sel;

	switch(main_sel)
	{
	case '1' :
		{
			display_header();
			cout << "**_______________________ E N R O L L M E N T  F O R M ______________________**" << endl;
			cout << "                                                                               " << endl;
			cout << "  Please enter the below details to complete the registration.                 " << endl;
			cout << "                                                                               " << endl;
			cout << "                                                                               " << endl;

			cout << "Firstname	|  ";
			cin >> fname;
			cout << "Lastname	|  ";
			cin >> lname;
			break;
		}

	}
	
	return 0;
}


void setcursor(int x, int y) 
{ 
	CursorPosition.X = x; 
	CursorPosition.Y = y; 
	SetConsoleCursorPosition(console,CursorPosition);
}

void cls() 
{ 
  system("cls"); 
} 
Last edited on
char fname, lname; means that fname, lname are single characters not strings
Topic archived. No new replies allowed.