The program needs to read in two sorted arrays each of at most 10 positive integers - assume that the user follows directions and enters only positive integers in ascending order - and merges them into one larger sorted array. -1 is the end of input flag.
Example of program:
Enter a sorted array of no more than 10 elements: 1 2 4 7 10 -1
Enter a sorted array of no more than 10 elements: 3 4 6 13 17 22 30 -1
Merged array: 1 2 3 4 4 6 7 10 13 17 22 30
The only problem: It drops off the last two outputs. If I try to make the output for loop output two more times, they are junk values. I'm not the best at debugging and I really can't find the problem with this. Please help.
I fixed the problem with the limits, and now it isn't cutting off the last two inputs (thank you!), but there is a problem with inputting multiple-digit numbers (such as 10, 100, etc.), and it will default their values to -2.