C ++程序未使用VS代码中的代码运行器提供任何输出

 收藏

我正在使用终端(GitBash)在VSCode中使用CodeRunner扩展名编译C ++程序。我在终端中没有输出。

First I tried a different program and it didn't work. So, I tried a program with a simple cout statement; but it didn't work too.

这是我的代码:

#include <iostream>
using namespace std;

class Point
{
    int x, y;

public:
    Point(int a, int b)
    {
        x = a;
        y = b;
    }

    void displayPoint()
    {
        cout << "The Point is (" << x << ", " << y << ")" << endl;
    }
};

int main()
{
    Point p(1, 1);
    p.displayPoint();
    cout << "Hello Garvit Sharma." << endl;
    Point q(4, 6);
    q.displayPoint();
    return 0;
}
回复