zoukankan      html  css  js  c++  java
  • C++ 存储类

    C++ 存储类
    存储类定义 C++ 程序中变量/函数的范围(可见性)和生命周期。这些说明符放置在它们所修饰的类型之前。下面列出 C++ 程序中可用的存储类:

    auto
    register
    static
    extern
    mutable
    thread_local (C++11)
    从 C++ 11 开始,auto 关键字不再是 C++ 存储类说明符,且 register 关键字被弃用。

     1 #include <iostream>
     2 
     3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
     4 #include<iomanip>
     5 #include<cmath>
     6 using namespace std;
     7 int main(int argc, char** argv) {
     8     int s=1;
     9     double n=1;
    10     double t=1;
    11     double pi=0;
    12     while((fabs(t))>1e-7)
    13     {
    14         pi=pi+t;
    15         n=n+2;
    16         s=-s;
    17         t=s/n;
    18     }
    19     pi=pi*4;
    20     cout <<"pi="<<setiosflags(ios::fixed)<<setprecision(6)<<pi<<endl;
    21     return 0;
    22 }
  • 相关阅读:
    12迭代器
    11(2)Vector(向量)
    11(1) LinkList ---链表
    11集合(Collection<E>) Arraylist
    10异常
    乘法计算过程的模拟
    10 Date详解
    详细的OA系统学习
    8 math类
    Java开发中的23种设计模式详解
  • 原文地址:https://www.cnblogs.com/borter/p/9400964.html
Copyright © 2011-2022 走看看