Visual studio scrubber [closed]

0

I try to debug the code with visual studio but when executing it step by step I change the window to a call ostream and I do not know what that is. Can you debug the code without having to go through the ostream window? For example, in this code it does that to me, and in other IDE it does not ...

    #include<iostream>
    using namespace std;

    int main()
    {
    int N, resultado=0, vector[100];
    cout << "Numero de veces: " << endl;
    cin >> N;
    for (int i = 0; i < N; i++) {

        vector[i] = i + 1;
        resultado = resultado + i;
        for (int j = 0; j <= i; j++) {

            cout << vector[j];
            if (j != i) {

                cout << "+";
            }
            else {
                cout << "=";
            }
        }
        cout << resultado+vector[i] << endl;

    }

    return 0;
}
    
asked by Chariot 21.02.2018 в 18:17
source

1 answer

2
  

I try to debug the code with visual studio but when I execute it step by step I change the window to an ostream call and I do not know what that is

ostream is the class of cout . cout , although it usually goes unnoticed, is a static instance (that's why you do not have to create it but you can use it at all times). In fact, in the library iostreams is usually declared like this:

extern std::ostream cout;

Well, this class is overloaded with the insertion operator << and, for the basic types, this overload is usually found together with the class. I mean, for example, the overload of char const* , as is your case:

cout << "Numero de veces: " << endl;
//   ^^^^^^^^^^^^^^^^^^^^^^

So, if you are debugging and you arrive at this call, it is normal for the debugger to jump to it ... which can be found in ostream or in any other file (it will depend on the implementation of the standard library you are using) ). Of course, the debugger can detect that the call is to the standard library and ignore the call ... after all, the standard library does not contain any code that you are going to modify.

And, seriously, I've said it a thousand times ... it's not the IDE thing. 99% of the problems of C / C ++ are not the fault of the IDE . The IDE is nothing more than an application that makes your life easier ... but the IDE does not compile but calls the compiler on duty and does not debug but communicates with the debugger that plays and shows you the output of it ... the IDE is a mere intermediary.

    
answered by 22.02.2018 / 07:38
source