C++ 引用自的错误:
给定一个函数的定义,当两条边作为参数给定时,该函数在屏幕上打印出矩形的其余两条边:C++ 引用自的错误:,c++,build,C++,Build,给定一个函数的定义,当两条边作为参数给定时,该函数在屏幕上打印出矩形的其余两条边: static void restPuncte (Punct &x, Punct &y); 及其实施: void restPuncte (Punct &x, Punct &y) { Punct c; c.MutaX(x.GetX()); c.MutaY(y.GetY()); Punct d; d.MutaX(y.GetX()); d
static void restPuncte (Punct &x, Punct &y);
及其实施:
void restPuncte (Punct &x, Punct &y)
{
Punct c;
c.MutaX(x.GetX());
c.MutaY(y.GetY());
Punct d;
d.MutaX(y.GetX());
d.MutaY(x.GetY());
std::cout << "Punctul C este:" << c << std::endl;
std::cout << "Punctul D este:" << d << std::endl;
}
主要问题是:
#include <iostream>
#include "punct.h"
using namespace std;
int main ()
{
Punct firstPoint(1,2);
Punct thirdPoint(4,3);
cout << "Determinarea celorlalte doua colturi" << endl;
cout << "Cele doua puncte sunt:" << firstPoint << " si " << thirdPoint <<endl;
Punct::restPuncte(firstPoint,thirdPoint);
return 0;
}
#包括
#包括“点h”
使用名称空间std;
int main()
{
点状第一点(1,2);
第三点(4,3);
库特
不一样
void Punct::restPuncte (Punct &x, Punct &y)
您正在定义一个自由函数,而您的静态
方法仍然未定义。其余的错误是什么?
void restPuncte (Punct &x, Punct &y)
void Punct::restPuncte (Punct &x, Punct &y)