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
|
// Filling a form.cpp : main project file.
#include "stdafx.h" // I use with MS Visual 2008 Express. Leave off if you use something different
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
COORD CursorPosition;
void gotoXY(int, int);
int main()
{
int location[6][2] = {{13,6},{41,6},{69,6},{13,8},{41,8},{25,10}},x,y,z;
// location array = groups of column, and row, for gotoXY()
string form[6]={"your name","father's name","mother's name","city of birth","your birthdate","your phone number"}, answer;
// string form[] = allowing different text to be printed for instructions
gotoXY(2,6); // locates 2nd column, sixth row
cout << "Your Name :__________ Father's Name :__________ Mother's Name:__________";
gotoXY(2,8); // locates 2nd column, eigthth row
cout << "Your City :__________ Your Birthday :__________";
gotoXY(2,10); // locates 2nd column, tenth row
cout << "Your TELEPHONE Number :__________";
for(x=0;x<6;x++)
{
gotoXY(16,15);
cout << "Please enter, in space provided, " << form[x] << ". ";
y=location[x][0];
z=location[x][1];
gotoXY(y,z);
cin >> answer;
}
gotoXY(19,21);
cout << "Thank you for your assistance!!";
gotoXY(19,23);
return 0;
}
void gotoXY(int x, int y)
{
CursorPosition.X = x;
CursorPosition.Y = y;
SetConsoleCursorPosition(console,CursorPosition);
}
|