funguje
This commit is contained in:
parent
e2dd8e7511
commit
a539a51b47
@ -82,8 +82,7 @@ void print_stack(struct stack* mystack)
|
||||
printf(" \n");
|
||||
}
|
||||
|
||||
int is_whitespace_only(const char* str)
|
||||
{
|
||||
int is_whitespace(const char* str) {
|
||||
while (*str)
|
||||
{
|
||||
if (!isspace((unsigned char)*str))
|
||||
@ -104,11 +103,6 @@ int main()
|
||||
{
|
||||
int flag=switch_operators(input);
|
||||
input[strcspn(input,"\n")]=0;
|
||||
if (strlen(input)==0 || is_whitespace_only(input))
|
||||
{
|
||||
printf("no input\n");
|
||||
return 0;
|
||||
}
|
||||
if (flag==0 || flag==-1)
|
||||
{
|
||||
if(flag==-1 && mystack.values[mystack.size-1]==0)
|
||||
@ -122,7 +116,7 @@ int main()
|
||||
else
|
||||
{
|
||||
char* ptr;
|
||||
if (*ptr!='\0')
|
||||
if (*ptr!='\0' && !is_whitespace(ptr))
|
||||
{
|
||||
printf("bad input\n");
|
||||
return 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user