zoukankan      html  css  js  c++  java
  • 第二十五章补充内容 18区域差异 简单

    // 第二十五章补充内容 18区域差异
    // 1 语言
    // 2 货币表示
    // 3 字符
    // 4 字符集
    // 5 时间表示的不同
    
    //18.1 locale类
    //为了解决地区差异,C++为我们提供了一个locale类
    
    //18.2 默认区域表示或全局区域表示
    
    //18.3 时间与地理设置
    //1 time返回系统当前的日历时间
    //该函数需要头文件time.h
    //time_t time(time_t *time)
    /*#include <time.h>
    #include <iostream>
    using namespace std;
    int main()
    {
        struct tm *ptr;
    	time_t t;
    	t = time(NULL);
    	ptr = localtime(&t);
    	cout<<asctime(ptr);
    	return 0;
    }*/
    
    //2 localtime()返回指向当前时间的指针
    // struct tm *localtime(const time_t *time)
    /*#include <iostream>
    #include <time.h>
    using namespace std;
    int main()
    {
    	struct tm *local;
    	time_t t;
    	t = time(NULL);
    	local = localtime(&t);
    	cout<<"本地时间日期:"<<asctime(local);
        return 0;
    }*/
    
    //3 asctime()时间文本格式
    //char *asctime(const struct tm *ptr)
    /*#include <iostream>
    #include <time.h>
    using namespace std;
    int main()
    {
       struct tm *ptr;
       time_t t;
       t = time(NULL);
       ptr = localtime(&t);
       cout<<asctime(ptr);
       return 0;
    }*/
    
    //4 clock()返回自程序开始运行所经过的时间
    //clock_t clock(void)
    /*#include <iostream>
    #include <time.h>
    using namespace std;
    void Rtime()
    {
         cout<<"调用该程序所花费的时间:"<<clock()/CLOCKS_PER_SEC<<"secs"<<endl;
    }
    int main()
    {
        for(int i=0; i<10000; i++){
    	   cout<<"i:"<<i<<endl;
    	}
       Rtime();
       return 0;
    }*/
    
    
    //5 ctime()返回自程序开始运行所经过的时间
    /*#include <time.h>
    #include <iostream>
    using namespace std;
    int main()
    {
         time_t t;
    	 t = time(NULL);
    	 cout<<ctime(&t);
    	 return 0;
    }*/
    
    //6 difftime()两时刻的时隔
    //double difftime(time_t time2, time_t time1)
    /*#include <iostream>
    #include <time.h>
    using namespace std;
    int main()
    {
    	time_t start,end;
    	start = time(NULL);
    	long unsigned i;
    	for(i=0; i<900000000; i++);
    	end = time(NULL);
    	cout<<"循环使用了:"<<difftime(end,start)<<"秒"<<endl;
        return 0;
    }*/
    
    //7 gmtime()返回指向当前格林威治时间的指针
    //struct tm *gmtime(const time_t *time)
    /*#include <iostream>
    #include <time.h>
    using namespace std;
    int main()
    {
    	struct tm *local,*gl;
    	time_t t;
    	t = time(NULL);
    	local = localtime(&t);
    	cout<<"本地日期时间:"<<asctime(local)<<endl;
    	gl = gmtime(&t);
    	cout<<"格林威治时间:"<<asctime(gl)<<endl;
        return 0;
    }*/
    
    
    //8 mktime()返回指定时间的日历格式
    //time_t mktime(struct tm *time)
    

      

  • 相关阅读:
    $router和$route的区别
    提莫攻击
    paste命令
    数组中的第K个最大元素
    od命令
    被围绕的区域
    不用虚机不用Docker使用Azure应用服务部署ASP.NET Core程序
    面试官:对象可能会迟到,但它永远不会缺席
    Kubernetes 的层级命名空间介绍
    每日一道 LeetCode (21):对称二叉树
  • 原文地址:https://www.cnblogs.com/xiangxiaodong/p/2725109.html
Copyright © 2011-2022 走看看