设为首页 加入收藏

TOP

程序填空题(二)(五)
2019-06-05 20:08:06 】 浏览:275
Tags:程序 填空
      ________________;                   // (1)

        ________________;                  //  (2)

        if((a+b)*(a+b)==n)

              cout<<n<<"  ";

    }

       cout<<endl;

       return 0;

}

 

7.求方程cos(x)-x=0的根

This program is to find the real root of function cos(x)-x=0.

#include <iostream>

#include <cmath>

using namespace std;

int main()  {

       float x0,x1=0.0;

       while(1)

       {

        ________________;                   // (1)

        ________________;                  //  (2)

              if(fabs(x0-x1)<1e-6)

                     break;

       }

       cout<<"The real root is "<<x1<<endl;

    return 0;

}

 

8.特殊的3位数

This program is to find the Perfect Square Numbers. which have 3 digits, and 2 of them are the same. e.g.100, 121, 144, 225, 400, 441, 484, 676, 900.

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

       int i,n,a,b,c;

       for (i=10;i<=sqrt(1000);i++)

       {

              _______________;         //  (1)

              a=n/100; 

              _______________;        //  (2)

              c=n%10;

              if (a==b || a==c || b==c)

                     cout<<n<<"  ";

       }

    cout<<endl;

    return 0;

}

 

9.三重回文数

This program is to find the Palindrome Numbers. whose square and cubic are also Palindrome Numbers.

#include <iostream>

using namespace std;

bool isPalindrome(int n)

{

    &

首页 上一页 2 3 4 5 6 7 8 下一页 尾页 5/8/8
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇P2801 教主的魔法 下一篇c++ 判断点和圆位置关系(类的声..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目