user input fix
This commit is contained in:
parent
86cae67ee8
commit
b37a846ed2
2 changed files with 12 additions and 16 deletions
BIN
puzzle1
BIN
puzzle1
Binary file not shown.
24
puzzle1.c
24
puzzle1.c
|
|
@ -11,26 +11,22 @@ char stringTwo[stringSize];
|
||||||
int readIntoList(char* stringList){
|
int readIntoList(char* stringList){
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
while(1){
|
while (1)
|
||||||
char next = getchar();
|
{
|
||||||
if (next != '\n'){
|
char next = getchar ();
|
||||||
|
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");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue