C
c
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
#include <stdio.h>
int continuing(char a);
int main() {
char prompt[25] = "\nPlay again? [y/n] > ";
char ans;
printf("Play game? [y/n] > ");
scanf("%c", &ans);
for (int i=0; i<10; i++){
if (!continuing(ans)){
puts("\nStopping!");
return 0;
}
//Here's where I'm stuck. I know I'm doing something wrong here. printf doesn't print out the prompt. How am I able to input a new value for the ans variable every iteration of the loop?
printf("%s", prompt);
scanf("%c", &ans);
//Arsenic fix
getchar();
}
return 0;
}
int continuing(char a) {
if (a=='y'){
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run