Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- main()
- {
- char line[100];
- char decision[100];
- printf("Are you gonna throw it?n");
- printf("Type yes or no.n");
- scanf("%s", line);
- printf("%s n", line);
- if (line == "yes") {
- printf("Thanks.n");
- } else if (line == "no") {
- printf("Why not?n");
- }
- printf("Do you want to do this again?n");
- scanf("%s", decision);
- if (decision == "yes") {
- main();
- };
- }
- if (strcmp(line, "yes") == 0) {
- printf("Thanks.n");
- } else if (strcmp(line, "no") == 0) {
- printf("Why not?n");
- }
- if (strcmp(line, "yes") == 0) { ... }
- if (decision == "yes")
- {
- main();
- }; //<-- if you want to keep this code at all
- strcmp(decision, "yes"); //returns 0 if they are equil
- main() {
- char line[100];
- char decision[100] = "yes";
- while(!strcmp(decision, "yes")){
- printf("Are you gonna throw it?n");
- printf("Type yes or no.n");
- scanf("%s", line);
- printf("%s n", line);
- if (!strcmp(line, "yes"))
- printf("Thanks.n");
- else if (!strcmp(line, "no"))
- printf("Why not?n");
- printf("Do you want to do this again?n");
- scanf("%s", decision);
- } //end while
- } //end main
Add Comment
Please, Sign In to add comment