當前位置:編程學習大全網 - 編程軟體 - 為什麽我的vc++編程無法輸出結果?

為什麽我的vc++編程無法輸出結果?

妳在包含頭文件的地方添加

#include<iostream>

using namespace std;

試試。

將上面兩句拿到妳定義類的文件的上面去。

如下:

#include <stdio.h>

#include <iostream.h>

using namespace std;

class myclass

{

private:

int x,y;

public:

myclass (int x=0,int y=0)

{

this->x=x;this->y=y;

}

void print ()

{

cout<<"x=:"<<x<<endl; cout<<"y=:"<<y<<endl;

}

~myclass ()

{

cout<<"hello"<<endl;

}

};

int main(void)

{

myclass my1,my2(3,4);

cout<<"my1:";

my1.print();

cout<<"my2:"; my2.print();

}

  • 上一篇:仿真軟件有那些
  • 下一篇:學Java開發還有用嗎?
  • copyright 2024編程學習大全網