Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- int main()
- {
- system("Title ***Name Guessing***");
- system("color 0A");
- int i, j, k, l, n;
- char ch, grid1[5][10], grid2[20][10], name[20];
- strcpy(grid1[0], "AFKPUZ");
- strcpy(grid1[1], "BGLQV.");
- strcpy(grid1[2], "CHMRW-");
- strcpy(grid1[3], "DINSX(");
- strcpy(grid1[4], "EJOTY)");
- printf("\n\t****Welcome, we are going to guess your name, please co-operate****\n\n");
- while(1){
- printf("Please enter the containing column number of your name's spelling's letters one by one from next table:\n\n");
- printf("Column No.%c\t1\t2\t3\t4\t5\n\n\t", 26);
- for(i = 0; i < 7; i++){
- for(j = 0; j < 5; j++){
- printf("\t%c", grid1[j][i]);
- }
- printf("\n\n\t");
- }
- printf("\tWhen your input ends, Enter NULL (press Ctrl+Z)\n\n\t\t");
- k = 0;
- while(scanf("%d", &i) != EOF){
- strcpy(grid2[k], grid1[i-1]);
- k++;
- printf("\t\t");
- }
- system("color 0E");
- printf("\n\tYes!!! You have almost done.........\n\nNow, Please enter the containing column number of your name's spelling's letters one by one from the printed line:\n\n");
- printf("\nColumn No.%c\t1\t2\t3\t4\t5\t6\n\n\t", 26);
- l = 0;
- for(i = 0; i < k; i++){
- for(j = 0; j < 7; j++){
- printf("\t%c", grid2[i][j]);
- }
- //printf("enter the column No.%c", 26);
- scanf("%d", &n);
- name[l] = grid2[i][n-1];
- l++;
- printf("\n\n\t");
- }
- name[l] = '\0';
- printf("\tI guess this is your name: %s\n", name);
- printf("\n\n\t\tDo you want to continue?\n\t\t\tTo continue press 1\n\t\t\tTo terminate press any other key\n\t\t\t\t\t\t\t");
- scanf("%d", &i);
- if(i == 1){
- system("cls");
- system("color 0A");
- printf("Let's go for another time...............\n\n");
- }
- else{
- system("color 0F");
- printf("Thank you! See you later.\nExiting................\n");
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement