Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <conio.h>
- char *ques[] = {"Hi\n", "How are you?\n", "What is your name?\n", "What is the capital of Bangladesh?\n"};
- char *ans[] = {"Hello!", "I am fine", "It's sss and you?", "The capital of Bangladesh is Dhaka"};
- char human_talks[150];
- char cont;
- int main()
- {
- int n = sizeof(ques)/sizeof(char *);
- printf("size %d\n", n);
- do
- {
- printf("Ask : ");
- // scanf("%[^\n]", &human_talks);
- fgets(human_talks, 150, stdin);
- int i = 0;
- for (i = 0; i < 4; i++)
- {
- if (strcmp(ques[i], human_talks) == 0)
- {
- printf("Ans : %s\n", ans[i]);
- break;
- }
- }
- cont = getch();
- } while (cont == 'y');
- // getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement