user input fix

This commit is contained in:
Seth Samuel 2024-12-01 19:55:24 +13:00
parent 86cae67ee8
commit b37a846ed2
2 changed files with 12 additions and 16 deletions

BIN
puzzle1

Binary file not shown.

View file

@ -11,25 +11,21 @@ char stringTwo[stringSize];
int readIntoList(char* stringList){ int readIntoList(char* stringList){
int index = 0; int index = 0;
while(1){ while (1)
{
char next = getchar (); char next = getchar ();
if (next != '\n'){ if (next == '.')
{
break;
}
else if (next != '\n')
{
stringList[index] = next; stringList[index] = next;
index++; index++;
}else{ }
break;
} }
} }
while (1) {
readChar = getchar();
stringList[index] = readChar;
if (readChar == '\n' || index == stringSize-1) {
break;
}
index++;
}
}
int main(){ int main(){
printf("enter list size: \n"); printf("enter list size: \n");