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

CodePudding user response:

reference 1st floor u012174761 response:
track several variables of the insert are not line?
Format is good, and the n=n + 1 is ok for you?
insert function is no problem, the main function is a little problem, still can't find oh

CodePudding user response:

refer to the second floor gzliudan response:
a lot of individual letters of the variables, the code is difficult to understand, in addition to your own
lesson is the problem

CodePudding user response:

reference u010920165 reply: 3/f
Quote: refer to 1st floor u012174761 response:

Several variables in tracking the insert is not line?
Format is good, and the n=n + 1 is ok for you?
insert function is no problem, the main function is a little problem, still can't find oh


You clearly said is "in the process of plug is out of the question"...

CodePudding user response:

reference 5 floor u012174761 reply:
Quote: refer to the third floor u010920165 response:

Quote: refer to 1st floor u012174761 response:

Several variables in tracking the insert is not line?
Format is good, and the n=n + 1 is ok for you?
insert function is no problem, the main function is a little problem, still can't find oh


You clearly said is "in the process of plug is out of the question"...


reference 5 floor u012174761 reply:
Quote: refer to the third floor u010920165 response:

Quote: refer to 1st floor u012174761 response:

Several variables in tracking the insert is not line?
Format is good, and the n=n + 1 is ok for you?
insert function is no problem, the main function is a little problem, still can't find oh


You clearly said is "in the process of plug is out of the question"...

How do you understand? Main function calls the insert function, isn't this process?

CodePudding user response:

refer to 6th floor u010920165 response:
Quote: refer to the fifth floor u012174761 reply:

Quote: refer to the third floor u010920165 response:

Quote: refer to 1st floor u012174761 response:

Several variables in tracking the insert is not line?
Format is good, and the n=n + 1 is ok for you?
insert function is no problem, the main function is a little problem, still can't find oh


You clearly said is "in the process of plug is out of the question"...


reference 5 floor u012174761 reply:
Quote: refer to the third floor u010920165 response:

Quote: refer to 1st floor u012174761 response:

Several variables in tracking the insert is not line?
Format is good, and the n=n + 1 is ok for you?
insert function is no problem, the main function is a little problem, still can't find oh


You clearly said is "in the process of plug is out of the question"...

How do you understand? Main function calls the insert function, isn't this process?

Let's skip this question...
You type that several variables to see not to know
  • Related