#include
using namespace std;
# define Initsize 100
typedef int ElemType;
Typedef struct {
ElemType * data;
Int MaxSize length;
} seqList;
Void Init (seqList * L)
{
L - & gt; Data=(ElemType * https://bbs.csdn.net/topics/malloc (sizeof (ElemType) * Initsize);
L - & gt; Length=0;
L - & gt; MaxSize=Initsize;
}
Void the create (seqList * L, int n)
{
int i;
For (I=0; I & lt; n; I++)
{
Cin & gt;> (L - & gt; Data [I]);
L - & gt; Length=n;
}
}
Void show (seqList L)
{
int i;
For (I=0; I & lt; L.l ength; I++)
{
cout}
}
Bool Del_Min (seqList * L, ElemType * value)
{
If (L - & gt; Length==0)
{
return false;
}
* value=https://bbs.csdn.net/topics/L-> data [0];
Int pos=0, I;
for (i=1; I & lt; L - & gt; Length; I++)
{
If (L - & gt; Data [I] <* value)
{
* value=https://bbs.csdn.net/topics/L-> data [I];
Pos=I;
}
}
L - & gt; Data (pos)=L - & gt; Data] [L - & gt; length - 1.
L - & gt; Length -;
return true;
}
Int main ()
{
Int n, the value;
SeqList L;
Init (& amp; L);
Cin & gt;> n;
Create (& amp; L, n);
Del_Min (& amp; L, & amp; value);
Show (L);
coutreturn 0;
}
No problem, you can remove a minimum value,
CodePudding user response:
You somehow smoothing out the code to give a person look