C++ 用类解决毕达哥拉斯三元组#includeusing std::cout;using std::endl;class functionBDGLS{public:functionBDGLS( int,int,int );int BDGLS( int,int,int );private:int a;int b;int c;}functionBDGLS::functionBDGLS( int ,int ,int ){int a = 0;int b
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/25 22:16:03
C++ 用类解决毕达哥拉斯三元组#includeusing std::cout;using std::endl;class functionBDGLS{public:functionBDGLS( int,int,int );int BDGLS( int,int,int );private:int a;int b;int c;}functionBDGLS::functionBDGLS( int ,int ,int ){int a = 0;int b
C++ 用类解决毕达哥拉斯三元组
#include
using std::cout;
using std::endl;
class functionBDGLS
{
public:
functionBDGLS( int,int,int );
int BDGLS( int,int,int );
private:
int a;
int b;
int c;
}
functionBDGLS::functionBDGLS( int ,int ,int )
{
int a = 0;
int b = 0;
int c = 0;
}
int functionBDGLS::BDGLS ( int ,int ,int )
{
int count = 0;
const M = 500;
for ( int a = 1; a < M; a++ )
{
for ( int b = 1; b < M; b++ )
{
for ( int c = 1; c < M; c++ )
{
if ((c*c) == ( a*a ) + ( b*b ))
cout
C++ 用类解决毕达哥拉斯三元组#includeusing std::cout;using std::endl;class functionBDGLS{public:functionBDGLS( int,int,int );int BDGLS( int,int,int );private:int a;int b;int c;}functionBDGLS::functionBDGLS( int ,int ,int ){int a = 0;int b
兄弟,你的类声明没有加分号.
class functionBDGLS
{
public:
functionBDGLS( int, int, int );
int BDGLS( int, int, int );
private:
int a;
int b;
int c;
}; // 这里的分号可不能丢哦!