none
有关tpoint.h头文件找不到问题 RRS feed

  • 问题

  • 大家好,请看下面的代码:

    // 数学体验.cpp : 定义控制台应用程序的入口点。
    //

    #include "stdafx.h"
    #include"stdio.h"
    #include<iostream>
    #include<tpoint.h>
    using namespace std;
    class point 
    {
    public:
    void setxy(int a,int b);
    void move(int ,int);
    void display();
    int getx();
    int gety();
    private:
    int x,y;
         

    };
    void point::setxy(int a,int b)
    {
      x=a;y=b;

    }
    void point::move(int a,int b)
    {
      x=x+a;y=y+b;

    }
    void display()
    {
      cout<<"x="<<getx()<<','<<"y="<<gety()<<endl;


    }
    int point::getx()
    {
       return x;

    }
    int point::gety()
    {
     return y;

    }
    int _tmain(int argc, _TCHAR* argv[])
    {
    point p1,p2,p3,*pt;
    pt=*p3;
    p1.setxy(4,7);
    p2.sety(2,9);
    pt->setxy(3,6);
    p1.move(1,2);
    p2.move(-1,3);
    (*pt).move(1,4);
    cout<<"x1="<<p1.getx()<<",y1="<<p1.gety()<<endl;
    cout<<"x2="<<p2.getx()<<",y2="<<p2.gety()<<endl;
    cout<<"x3="<<pt->getx()<<",y3="<<(*pt).gety()<<endl;

    return 0;
    }

    请问如何在VC++中给类和对象编程?如何才能找到上述的头文件?

    2012年6月20日 3:16

答案

  • 找写这段代码的人要找不到的头文件


    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP

    2012年6月20日 5:14
    版主

全部回复