user input fix
This commit is contained in:
28
puzzle1.c
28
puzzle1.c
@@ -11,26 +11,22 @@ char stringTwo[stringSize];
|
||||
int readIntoList(char* stringList){
|
||||
int index = 0;
|
||||
|
||||
while(1){
|
||||
char next = getchar();
|
||||
if (next != '\n'){
|
||||
stringList[index] = next;
|
||||
index++;
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while (1) {
|
||||
readChar = getchar();
|
||||
stringList[index] = readChar;
|
||||
if (readChar == '\n' || index == stringSize-1) {
|
||||
break;
|
||||
while (1)
|
||||
{
|
||||
char next = getchar ();
|
||||
if (next == '.')
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (next != '\n')
|
||||
{
|
||||
stringList[index] = next;
|
||||
index++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(){
|
||||
printf("enter list size: \n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user