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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
#include <windows.h>
void gotoxy(int x,int y);
int main(int argc, char *argv[])
{
char urname[15],surname[15],fullname[30],nput;
int cntr;
cntr=0;
start:
system("COLOR 1c");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),161);
gotoxy(6,9);
printf(" ");
gotoxy(6,10);
printf(" ");
gotoxy(6,11);
printf(" ");
gotoxy(6,12);
printf(" ");
gotoxy(6,13);
printf(" ");
gotoxy(6,14);
printf(" ");
gotoxy(6,15);
printf(" ");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),121);
gotoxy(9,10);
printf(" Please enter your name: ");
gotoxy(9,12);
printf(" Please enter your surname: ");
gotoxy(9,14);
printf(" Your name is: ");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),151);
gotoxy(37,10);
printf(" ");
gotoxy(37,12);
printf(" ");
gotoxy(37,14);
printf(" ");
gotoxy(40,10);
cntr=0;
bb:
nput=getche();
if(nput==13){
urname[cntr]='\0';
goto ee;
}
else{
if(nput==8){
if(cntr==0){
urname[cntr]='\0';
printf(" ");
goto bb;
}
else{
printf(" \b");
urname[cntr]='\0';
cntr--;
goto bb;
}
}
else{
urname[cntr]=nput;
cntr++;
if(cntr>14){
goto ee;
}
else
goto bb;
}
}
ee:
gotoxy(40,12);
cntr=0;
cc:
nput=getche();
if(nput==13){
surname[cntr]='\0';
goto aa;
}
else{
if(nput==8){
if(cntr==0){
surname[cntr]='\0';
printf(" \b ");
goto cc;
}
else{
printf(" \b");
surname[cntr]='\0';
cntr--;
goto cc;
}
}
else{
surname[cntr]=nput;
cntr++;
if(cntr>14){
goto aa;
}
else
goto cc;
}
}
aa:
gotoxy(40,14);
printf("%s %s",urname,surname);
fullname[cntr]='\0';
{
char choice;
ron:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),11);
gotoxy(35,15);
printf(" Do you want to enter ");
gotoxy(35,16);
printf(" another entry? ");
gotoxy(35,17);
printf(" ");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),116);
gotoxy(40,17);
printf("YES");
gotoxy(50,17);
printf("NO");
choice= getche();
if (choice=='y'){
goto start;
}
if (choice=='n'){
printf("");
}
else
goto ron;
}
}
void gotoxy(int x, int y){
COORD coord = {x,y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
|