Add Score Var
This commit is contained in:
parent
bf7aa9194b
commit
99310a46f1
12
main.c
12
main.c
|
@ -1,20 +1,22 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
char characterName;
|
||||
int characterAge;
|
||||
int score = 0;
|
||||
|
||||
char playerName;
|
||||
int playerAge;
|
||||
|
||||
printf("Welcome to my quiz!\n");
|
||||
|
||||
printf("What is your name: ");
|
||||
scanf("%s", &characterName);
|
||||
scanf("%s", &playerName);
|
||||
printf("\n");
|
||||
|
||||
printf("What is your age: ");
|
||||
scanf("%d", &characterAge);
|
||||
scanf("%d", &playerAge);
|
||||
printf("\n");
|
||||
|
||||
printf("Hello %c! You are %d years old.\n", characterName, characterAge);
|
||||
printf("Hello %c! You are %d years old. Your current score is: %d", playerName, playerAge, score);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue