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>
|
#include <stdio.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
char characterName;
|
int score = 0;
|
||||||
int characterAge;
|
|
||||||
|
char playerName;
|
||||||
|
int playerAge;
|
||||||
|
|
||||||
printf("Welcome to my quiz!\n");
|
printf("Welcome to my quiz!\n");
|
||||||
|
|
||||||
printf("What is your name: ");
|
printf("What is your name: ");
|
||||||
scanf("%s", &characterName);
|
scanf("%s", &playerName);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("What is your age: ");
|
printf("What is your age: ");
|
||||||
scanf("%d", &characterAge);
|
scanf("%d", &playerAge);
|
||||||
printf("\n");
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue