Home > Back-end >  Delete the Numbers
Delete the Numbers

Time:12-06

# include
Int the delete (int d, int a []);
Int main (void)
{
Int a [6]={3,2,1,4,5,6};
Int d, I, pos.
Printf (" please enter the number you are trying to remove \ n ");
The scanf (" % d ", & amp; D);
Pos=delete (d, a);
For (I=pos. i<5; I++)
{
A [I]=a, [I + 1].
}
for(i=0; i<5; I++)
{
Printf (" % d ", a [I]);
}
return 0;
}
Int the delete (int d, int a [])
{
Int j;
for(j=0; A [j]==d; J++)
{
}
Return j;

}
Purpose is to remove one of the top five figures, and then forward a Numbers, but the results, no matter which one I input, the deleted are first, strives for the bosses give directions

CodePudding user response:

Delete is the keyword, and cannot be defined as a function of the
reference
int the delete (int d, int a [])
{
Int j;
for(j=0; A [j]==d; J++)
{
}
Return j;

}
the function, for there must be at least a '; 'and modified as follows, for your reference:
 # include 
Int delete_my (int d, int a [], int n);

Int main (int arg c, char * argv [])
{
Int a [6]={3,2,1,4,5,6};
Int d, I, pos.
Printf (" please enter the number you are trying to remove \ n ");
The scanf (" % d ", & amp; D);

Pos=delete_my (d, a, 6);
If (pos<{
=5)For (I=pos. i<5; I++)
{
A [I]=a, [I + 1].
}
Pos=6-1;
}
for(i=0; i{
Printf (" % 4 d ", a [I]);
}
system("pause");
return 0;
}

Int delete_my (int d, int a [], int n)
{
Int j;
for(j=0; JIf (a==[j] d) break;
}
Return j;

}
  • Related