Tuesday 15 January 2013

c++ - user input array program keeps returning 255 -


I have done something wrong I know that this program is crashing when it should display an array.

This code is:

  #include & lt; Iostream & gt; using namespace std; Int Search for the best valuation (int input_group [], integer size, int index); Zero swap (int input_values ​​[], int first_index, int second_index); Zero entry sort (int input_values ​​[], integer size); Zero display ray (int input_values ​​[], integer size); Int * userInput (int input_values ​​[], integer size); Int main () {int input_values ​​[50]; User input (input_group, 50); For {int i = 0; i & lt; 50; i ++} {cout & lt; & Lt; Input_values ​​[i]; } InsertionSort (input_group, 50); DisplayArray (input_group, 50); Cout & lt; & Lt; "\ N"; } Zero entry (int input_values ​​[], int size) {for (int i = 0; i  

The program crashes with error code 255 unless I stop it quickly (which gives it some strange negative values).

The program has a solution to the problem of practice in series + arrays (eg, this entry is sorted) but jump in C ++.

This is the problem:

Write a program that takes up 50 values ​​and the highest, lowest, average, and then all 50 input values, one per line.

I edited this post with the latest update of the code. Even after adding the return statement I keep this weird array output

  return user_input;  

So what's with it? This only warns me:

Warning: The address of the local variable 'user_input' is back [enabled by default]

related to the return statement.

You do this:

User input (input_values) [50], 50)

which should be

User input (by input_50)

Many times, second comment: You can also take input in a loop, as you cautize in the main part of your program.


No comments:

Post a Comment