Home > Back-end > Pray god to help me take a look at why this program run out is always the result of the cross
Pray god to help me take a look at why this program run out is always the result of the cross
Time:10-14
To attach a source: #include #include #include Const int maxsize=1000; Struct seqlist { Int v [maxsize]; }; Int the insert (int a [], int b, int n, int m) { int i; If (n==m) cout<" Overflow "; The else { If (n==0) [n]=b; The else { I=n - 1; While ((i>=0) & amp; & (a [I] & gt; B)) {a [I + 1)=a, [I]. i=i-1; } [I + 1]=b; } N=n + 1; } Return n. }
Void main () { Int a [maxsize], k; Seqlist list; cout<" Please input k value "& lt; Cin> k; Ifstream in; In the open (" Random. TXT "); if(! In) {cout<" Can not open the Random. TXT "& lt; for(int i=0; i A, [I]. coutFor (int j=0; jInsert (list. V, a [j], k, maxsize); for(int n=0; nsystem("pause"); } From Random. TXT read in a number of Random Numbers, and then read a [] array, and then insert the list in sequence. The v [], in the process of plug is out of the question, a great god help look!
CodePudding user response:
Several variables in tracking the insert is not line? Format is good, and the n=n + 1 is ok for you?
CodePudding user response:
A lot of individual letters of the variables, the code is difficult to understand, but yourself