Install CLion on ubuntu. After running the code, it often displays incorrect values. It is necessary to run the code several times so that it gives the entire answer. For example: I created an array of 10 elements and filled it with random values, displayed it through a loop on the screen. In theory, everything is correct, but often not all numbers are output, and in order to achieve full array output, you must run the code several times. This problem does not apply only to arrays. Checked through debugger, everything works fine, but when I display on the screen, often the information is not correct. enter image description here

#include "iostream" #include "ctime" using namespace std; void bubbleSort(int *arr, int size) { int tmp, i, j; for (i = 0; i < size - 1; ++i) // i - номер прохода { for (j = 0; j < size - 1; ++j) // внутренний цикл прохода { if (arr[j + 1] < arr[j]) { tmp = arr[j + 1]; arr[j + 1] = arr[j]; arr[j] = tmp; } } } } int main() { int* N = new int; cin >> *N; int * pArray = new int[*N]; srand((unsigned int)time(NULL)); for(int i = 0; i < *N; i++) { pArray[i] = 1 + rand() % 100; cout << pArray[i] << endl; } bubbleSort(pArray, *N); for (int j = 0; j < *N; j++) { cout << pArray[j] << " "; } delete [] pArray; return 0; } 
  • can you attach sample code and sample output so as not to guess? - pavel
  • perhaps the problem is with the code (uninitialized variable for example). - pavel
  • Unfortunately, the problem remained. Ubuntu - user210630

1 answer 1

This issue needs to be resolved in CLion 2016.1.2 RC, just upgrade.

Relevant applications for bug tracker:
https://youtrack.jetbrains.com/issue/CPP-6354
https://youtrack.jetbrains.com/issue/CPP-6325

  • I thought so too, that's why I set myself a CLion 2016.1.2 RC, with a screenshot taken from it. Still incorrectly gives the result as on 2016.1.1 - LordGarod
  • I checked, yes, you're right - the problem remains. - Pavel Parshin
  • clion had another problem with formatting, everything is a little trickier here :-) business - sure - incorrect generation of random numbers - strangeqargo

Protected by spirit community member Jun 6 '16 at 18:00 .

Thank you for your interest in this issue. Since he collected a large number of low-quality and spam responses, which had to be deleted, now it’s necessary to have 10 reputation points on the site (the bonus for account association is not counted ).

Maybe you want to answer one of the unanswered questions ?