mirror of
https://github.com/Soccera1/agg.git
synced 2025-11-04 10:27:33 +01:00
Compare commits
No commits in common. "51e72669112fe69e9e2c42cb42dc13af80efb35a" and "effe06fca46acea3865ef987b9ab0aa8c27bfcca" have entirely different histories.
51e7266911
...
effe06fca4
1 changed files with 3 additions and 18 deletions
21
src/agg.c
21
src/agg.c
|
|
@ -5,21 +5,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int isbool(char entered []) {
|
||||
int valid = 1;
|
||||
for (int i = 0; i < strlen(entered); i++) {
|
||||
switch (entered[i]) {
|
||||
case '0':
|
||||
case '1':
|
||||
break;
|
||||
default:
|
||||
valid = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
int isvalidnumber(char entered []) {
|
||||
int valid = 1;
|
||||
for (int i = 0; i < strlen(entered); i++) {
|
||||
|
|
@ -59,7 +44,7 @@ int main(void) {
|
|||
|
||||
printf ("Hello %s!\nThis is a game written for AgnoxGD.\nWould you like to see a tutorial\nType 1 for no, or 0 for yes.\n", username);
|
||||
scanf("%s", input);
|
||||
if (isbool(input)) {
|
||||
if (isvalidnumber(input)) {
|
||||
sscanf(input, "%d", &tempInput);
|
||||
tutorial = tempInput;
|
||||
} else {
|
||||
|
|
@ -73,9 +58,9 @@ int main(void) {
|
|||
|
||||
int accuracytype;
|
||||
printf ("\nWould you like your accuracy as a float or as an int? Type 0 for float or 1 for int.\n");
|
||||
scanf ("%s", input);
|
||||
scanf ("%s", input);
|
||||
|
||||
if (isbool(input)) {
|
||||
if (isvalidnumber(input)) {
|
||||
sscanf(input, "%d", &accuracytype);
|
||||
} else {
|
||||
printf ("Error! An invalid character was entered.\n");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue