C/C++教程

敲代码的第五天:不知名(c++)

本文主要是介绍敲代码的第五天:不知名(c++),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

#include<iostream>
#include<cmath>
using namespace std;
int find(n){
    int count = 0;
    long num=0,x = 0, y = 0;
    while(1){
        num++;
        x = sqrt(num+100);
        y = sqrt(num+268);
        if(x*x==num+100&&y*y==num+268){
            cout<<"num="<<num<<endl;
            count++;
            if(count==n)
            break;
        } 
    }
    return 0;

}
int main(void){
    int n=3;
    find();
    return 0;
}
 

这篇关于敲代码的第五天:不知名(c++)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!