I was trying to learn C++ on my own, and there's a weird result from my first testing with the code in VSCode.
My testing code is as below:
#include <iostream>
using namespace std;
int main()
{
int x, y, sum = 0;
for (int x = 0; x < 5; x++)
{
y += 2;
sum = x + y;
cout << "The sum is = " << sum << "\n";
if (x == 5)
{
break;
return 0;
}
}
}
Which is supposed to give out the results as:
Above is the correct result which I tested on other online compilers. While in VSCode, I get the below result instead in the terminal after I run the code:
Is it just me or VSCode is not suitable or are there things I should configure/set up for C++? Thanks