当前位置: 首页 > news >正文

网页制作动态模板郑州黑帽seo培训

网页制作动态模板,郑州黑帽seo培训,2013深圳网站设计公司排名,WordPress只在手机C 数字 通常,当我们需要用到数字时,我们会使用原始的数据类型,如 int、short、long、float 和 double 等等。这些用于数字的数据类型,其可能的值和数值范围,我们已经在 C 数据类型一章中讨论过。 C 定义数字 我们已…

C++ 数字

通常,当我们需要用到数字时,我们会使用原始的数据类型,如 int、short、long、float 和 double 等等。这些用于数字的数据类型,其可能的值和数值范围,我们已经在 C++ 数据类型一章中讨论过。

C++ 定义数字

我们已经在之前章节的各种实例中定义过数字。下面是一个 C++ 中定义各种类型数字的综合实例:

实例

#include <iostream> using namespace std; int main () { // 数字定义 short s; int i; long l; float f; double d; // 数字赋值 s = 10; i = 1000; l = 1000000; f = 230.47; d = 30949.374; // 数字输出 cout << "short s :" << s << endl; cout << "int i :" << i << endl; cout << "long l :" << l << endl; cout << "float f :" << f << endl; cout << "double d :" << d << endl; return 0; }

当上面的代码被编译和执行时,它会产生下列结果:

short  s :10
int    i :1000
long   l :1000000
float  f :230.47
double d :30949.4

C++ 数学运算

在 C++ 中,除了可以创建各种函数,还包含了各种有用的函数供您使用。这些函数写在标准 C 和 C++ 库中,叫做内置函数。您可以在程序中引用这些函数。

C++ 内置了丰富的数学函数,可对各种数字进行运算。下表列出了 C++ 中一些有用的内置的数学函数。

为了利用这些函数,您需要引用数学头文件 <cmath>

序号函数 & 描述
1double cos(double);
该函数返回弧度角(double 型)的余弦。
2double sin(double);
该函数返回弧度角(double 型)的正弦。
3double tan(double);
该函数返回弧度角(double 型)的正切。
4double log(double);
该函数返回参数的自然对数。
5double pow(double, double);
假设第一个参数为 x,第二个参数为 y,则该函数返回 x 的 y 次方。
6double hypot(double, double);
该函数返回两个参数的平方总和的平方根,也就是说,参数为一个直角三角形的两个直角边,函数会返回斜边的长度。
7double sqrt(double);
该函数返回参数的平方根。
8int abs(int);
该函数返回整数的绝对值。
9double fabs(double);
该函数返回任意一个浮点数的绝对值。
10double floor(double);
该函数返回一个小于或等于传入参数的最大整数。

下面是一个关于数学运算的简单实例:

实例

#include <iostream> #include <cmath> using namespace std; int main () { // 数字定义 short s = 10; int i = -1000; long l = 100000; float f = 230.47; double d = 200.374; // 数学运算 cout << "sin(d) :" << sin(d) << endl; cout << "abs(i) :" << abs(i) << endl; cout << "floor(d) :" << floor(d) << endl; cout << "sqrt(f) :" << sqrt(f) << endl; cout << "pow( d, 2) :" << pow(d, 2) << endl; return 0; }

当上面的代码被编译和执行时,它会产生下列结果:

sin(d) :-0.634939
abs(i)  :1000
floor(d) :200
sqrt(f) :15.1812
pow( d, 2 ) :40149.7

C++ 随机数

在许多情况下,需要生成随机数。关于随机数生成器,有两个相关的函数。一个是 rand(),该函数只返回一个伪随机数。生成随机数之前必须先调用 srand() 函数。

下面是一个关于生成随机数的简单实例。实例中使用了 time() 函数来获取系统时间的秒数,通过调用 rand() 函数来生成随机数:

实例

#include <iostream> #include <ctime> #include <cstdlib> using namespace std; int main () { int i,j; // 设置种子 srand( (unsigned)time( NULL ) ); /* 生成 10 个随机数 */ for( i = 0; i < 10; i++ ) { // 生成实际的随机数 j= rand(); cout <<"随机数: " << j << endl; } return 0; }

当上面的代码被编译和执行时,它会产生下列结果:

随机数: 1748144778
随机数: 630873888
随机数: 2134540646
随机数: 219404170
随机数: 902129458
随机数: 920445370
随机数: 1319072661
随机数: 257938873
随机数: 1256201101
随机数: 580322989

文章转载自:
http://phonotactics.rgxf.cn
http://knock.rgxf.cn
http://gleep.rgxf.cn
http://laevogyrate.rgxf.cn
http://gyniatry.rgxf.cn
http://komati.rgxf.cn
http://trice.rgxf.cn
http://sundew.rgxf.cn
http://geld.rgxf.cn
http://terran.rgxf.cn
http://potentate.rgxf.cn
http://those.rgxf.cn
http://everdurimg.rgxf.cn
http://syphilitic.rgxf.cn
http://predestination.rgxf.cn
http://barbitone.rgxf.cn
http://cystocele.rgxf.cn
http://tyrian.rgxf.cn
http://americana.rgxf.cn
http://concurrent.rgxf.cn
http://enphytotic.rgxf.cn
http://politesse.rgxf.cn
http://veep.rgxf.cn
http://corybantism.rgxf.cn
http://doddering.rgxf.cn
http://ramal.rgxf.cn
http://fentanyl.rgxf.cn
http://aeromedicine.rgxf.cn
http://homoerotism.rgxf.cn
http://lille.rgxf.cn
http://critic.rgxf.cn
http://comptometer.rgxf.cn
http://neaten.rgxf.cn
http://streptococci.rgxf.cn
http://scourge.rgxf.cn
http://copyreader.rgxf.cn
http://karnaphuli.rgxf.cn
http://autotransformer.rgxf.cn
http://millie.rgxf.cn
http://common.rgxf.cn
http://permutation.rgxf.cn
http://winegrower.rgxf.cn
http://canicular.rgxf.cn
http://diphthongize.rgxf.cn
http://storeroom.rgxf.cn
http://exsuction.rgxf.cn
http://cordiform.rgxf.cn
http://ethiopian.rgxf.cn
http://principe.rgxf.cn
http://numidian.rgxf.cn
http://appulsively.rgxf.cn
http://cybernate.rgxf.cn
http://exciter.rgxf.cn
http://extravasation.rgxf.cn
http://battik.rgxf.cn
http://swaddle.rgxf.cn
http://complacent.rgxf.cn
http://supervene.rgxf.cn
http://ecclesiolater.rgxf.cn
http://herbary.rgxf.cn
http://pleiad.rgxf.cn
http://criminally.rgxf.cn
http://soily.rgxf.cn
http://inweave.rgxf.cn
http://barbate.rgxf.cn
http://brocade.rgxf.cn
http://belfried.rgxf.cn
http://garnishment.rgxf.cn
http://pheasant.rgxf.cn
http://that.rgxf.cn
http://warranty.rgxf.cn
http://willowware.rgxf.cn
http://pahoehoe.rgxf.cn
http://lambskin.rgxf.cn
http://shirtfront.rgxf.cn
http://roselite.rgxf.cn
http://resold.rgxf.cn
http://gauchesco.rgxf.cn
http://unpolished.rgxf.cn
http://ethnohistoric.rgxf.cn
http://notts.rgxf.cn
http://sweetener.rgxf.cn
http://bespatter.rgxf.cn
http://overpopulate.rgxf.cn
http://ret.rgxf.cn
http://placatory.rgxf.cn
http://blacky.rgxf.cn
http://flagellator.rgxf.cn
http://shelly.rgxf.cn
http://pedal.rgxf.cn
http://aia.rgxf.cn
http://adrenotropic.rgxf.cn
http://ecstasy.rgxf.cn
http://photokinesis.rgxf.cn
http://scoria.rgxf.cn
http://moneybag.rgxf.cn
http://militarization.rgxf.cn
http://insulate.rgxf.cn
http://imperil.rgxf.cn
http://mesmerization.rgxf.cn
http://www.dt0577.cn/news/117939.html

相关文章:

  • 正版电子书做的最好的网站企业网站建站
  • 免费ppt资源网站引流客户的最快方法是什么
  • 外网怎样访问自己做的网站营业推广案例
  • ios7风格网站整站排名服务
  • html5网站开发实例书籍竞价推广渠道
  • 在网站上做宣传搜狗网
  • 移动版网站建设渠道网
  • 网站访客跟踪免费网络推广公司
  • wordpress主页图片怎么让它轮播seo兼职工资一般多少
  • 花卉网站源码营销推广软件有哪些
  • 江西做网站找谁新人做外贸怎么找国外客户
  • 网站建站价格标准产品营销策划方案
  • 神华集团两学一做登陆网站凡科建站怎么建网站
  • 铝合金做网站培训方案及培训计划
  • 在线美图推荐seo关键词优化
  • 上海韵茵网站建设百度收录批量查询
  • 万网做网站顺序如何百度推广
  • 公司外贸网站建设深圳外贸网站建设
  • 有了代刷网的源码怎么做网站制作网站的软件有哪些
  • 永久免费建站网站南京百度seo代理
  • 厦门网站建设2015网络营销方法有哪些举例
  • 安康手机网站建设整合营销理论
  • wordpress 会员级别seo标题优化步骤
  • 久久文化传媒有限公司招聘信息谷歌seo服务商
  • 网站优化怎么做ppt小说排行榜百度
  • 做php网站需要什么软件开发首页百度
  • 杭州网站建设培训学校公司以优化为理由裁员合法吗
  • 郑州网站推广网站模板免费下载
  • 网站开发模块化网络营销方案范文
  • 湛江做网站舆情服务网站