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 89 90 91 92 93 94 95 96
|
// Data Form.cpp : main project file.
#include <iostream>
#include <string>
#include <Windows.h>
using namespace std;
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE); // For gotoXY() function
COORD CursorPosition;
void gotoXY(int x, int y);
int main ()
{
string first_name;
string last_name;
string address;
string email;
string class1;
int phone;
int age;
char sex;
gotoXY(30,2);
cout << "*************************";
gotoXY(30,3);
cout << "* Header *";
gotoXY(30,4);
cout << "* Personal Information *";
gotoXY(30,5);
cout << "*************************";
gotoXY(10,10);
cout << "First Name:";
gotoXY(40,10);
cout << "Last Name:";
gotoXY(10,13);
cout << "Address:";
gotoXY(40,13);
cout << "Email:";
gotoXY(10,16);
cout << "Phone:";
gotoXY(40,16);
cout << "Sex: [M] [F]";
gotoXY(10,19);
cout << "Age:";
gotoXY(40,19);
cout << "Department:";
gotoXY(10,11);
cout << "_\b";
cin >>first_name;
gotoXY(40,11);
cout << "_\b";
cin >>last_name;
cin.ignore();
gotoXY(10,14);
cout << "_\b";
getline(cin, address); // So a space between address number and street name, stays as one input
gotoXY(40,14);
cout << "_\b";
cin >> email;
cin.ignore();
gotoXY(10,17);
cout << "_\b";
cin >> phone;
gotoXY(40,17);
cout << "_\b";
cin >> sex;
gotoXY(10,20);
cout << "_\b";
cin >> age;
gotoXY(40,20);
cout << "_\b";
getline(cin, class1);
cin.ignore();
system ("PAUSE");
return 0;
}
void gotoXY(int x, int y)
{
CursorPosition.X = x;
CursorPosition.Y = y;
SetConsoleCursorPosition(console,CursorPosition);
}
|