Update code.c
This commit is contained in:
@@ -93,21 +93,23 @@ int fillmass(int size, int *massive){
|
|||||||
while(((x = getchar()) != '\n' && x !=' '
|
while(((x = getchar()) != '\n' && x !=' '
|
||||||
&& x != EOF && x != 4)
|
&& x != EOF && x != 4)
|
||||||
&& ((x>='0' && x<='9')
|
&& ((x>='0' && x<='9')
|
||||||
|| x == 'e' || x == '-'))
|
|| x == 'e' || (x == '-' && e==0 && massive[i]==0)))
|
||||||
{
|
{
|
||||||
if (x == 'e')e1=1;
|
if (x == 'e')e1=1;
|
||||||
|
else if (x == '-')minus=1;
|
||||||
|
|
||||||
else if (e1) e = (e*10)+(x-'0');
|
else if (e1) e = (e*10)+(x-'0');
|
||||||
else if (x == '-' && massive[i]==0)minus=1;
|
|
||||||
else massive[i] = (massive[i]*10) + (x-'0');
|
else massive[i] = (massive[i]*10) + (x-'0');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(x == EOF || x == 3){return 0;}
|
if(x == EOF || x == 3){return 0;}
|
||||||
|
if(e1&&minus)minus=0;
|
||||||
if(minus && (x == '\n' || x == ' ')){minus = 0; massive[i]*=-1;}
|
if(minus && (x == '\n' || x == ' ')){minus = 0; massive[i]*=-1;}
|
||||||
if(e>size) printf("e is out of range.\n");
|
if(e>size) {printf("e is out of range.\n");i=p;}
|
||||||
else if(e1) {i = e - 1;putchar('\n');}
|
else if(e1) {i = e - 1;putchar('\n');}
|
||||||
if(x == 'g'){return 1;}
|
if(x == 'g'){return 1;}
|
||||||
if(x!='\n' && x!=' ' && x!='e' && x!='-' && !(x>='0'&&x<='9'))
|
if((x<='0' && x>='9')||x==' '||x=='\n'||x>=32);
|
||||||
{while((x=getchar())!='\n'&&x!=' '&&x!=EOF&&x!=4);i--;}
|
else {while((x=getchar())!='\n'&&x!=' '&&x!=EOF&&x!=4);i--;}
|
||||||
if(p!=i&&e1!=1)
|
if(p!=i&&e1!=1)
|
||||||
printf("Massive - [%d]\t%d\n",i,massive[i]);
|
printf("Massive - [%d]\t%d\n",i,massive[i]);
|
||||||
p=i;
|
p=i;
|
||||||
@@ -119,7 +121,7 @@ int fillmass(int size, int *massive){
|
|||||||
void viewmass(int size, int *massive){
|
void viewmass(int size, int *massive){
|
||||||
printf("\t\tView Massive\n");
|
printf("\t\tView Massive\n");
|
||||||
for(int i = 0; i < size; i++){
|
for(int i = 0; i < size; i++){
|
||||||
printf(" | [%6d]\t%p\t%d\n",i,massive[i],massive[i]);
|
printf(" | [%6d]\t%p\t%d\n",i,&massive[i],massive[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +147,6 @@ void selfunc(int *massive){
|
|||||||
flush();
|
flush();
|
||||||
return;
|
return;
|
||||||
switch(n){
|
switch(n){
|
||||||
case 1:
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user