c++dev-c++

Why my code in c++ is taking too long to execute?


When I click to compile and run my code in C++, using Dev-C++, the code takes a while to run in the console, even though it's something very basic. The console screen opens and goes black, with the cursor blinking, the program only starts after a few seconds. How can I solve this problem?

#include <iostream>
using namespace std;

int main() {
    int valor[5];
    int i;

    for (i = 0; i < 5; i++) {
        cout << "digite valor[" << i << "]" << endl;
        cin >> valor[i] ;
    }
    for (i = 0; i < 5; i++) {
        cout << "valor[" << i << "]: " << valor[i] << endl;
    }

    return 0;
}

Solution

  • Got a similar issue some years ago at work, with the imposed antivirus. All compiled executables, even the smaller one, took several seconds to really be launched.

    We were forced to request some special rights to IT in order to be able to exclude from scanning our development folders. It solved the problem instantly.

    You should be able to tell your antivirus to exclude your base development folder (let's say "C:\Users\malkmim\Projects" and all its subfolders) from scan, and then test again if you still have this issue.