zoukankan      html  css  js  c++  java
  • 在编写函数时,要进行反复的考查,并且自问: “我打算做哪些假定?”

    在编写函数时,要进行反复的考查,并且自问: “我打算做哪些假定?”

    一旦确定了的假定,就要使用断言对假定进行检查。

     1 #include <iostream>
     2 #include <time.h>
     3 #include <sys/types.h>
     4 #include <sys/stat.h>
     5 #include <stdio.h>
     6 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
     7 
     8 using namespace std;
     9 int main(int argc, char** argv) {
    10     struct stat buf;
    11     int result;
    12 
    13     //获得c:WindowsCalc.exe文件的状态信息
    14     result =stat( "c:\windows\Calc.exe", &buf );
    15 
    16     //显示Calc.exe文件的状态信息
    17    if( result != 0 )
    18        perror( "Problem getting information" );
    19     else
    20     {
    21         cout<<"Size of the file in bytes:"<<buf.st_size<<endl;
    22         cout<<"Drive number of the disk containing the file :";
    23         cout<<char(buf.st_dev + 'A')<<endl;
    24         cout<<"Time of creation of the file:"<<ctime(&buf.st_ctime);
    25         cout<<"Time of last access of the file:"<<ctime(&buf.st_atime);
    26         cout<<"Time of last modification of the file:"<<ctime(&buf.st_mtime);
    27    }
    28     return 0;
    29 }
  • 相关阅读:
    成熟到优秀的瓶颈问题
    今天我们为什么不成功
    将HTML标签变为小写
    2010世界杯 排阵型 猜比分
    又一款 jQuery 头图切换形式
    整理下工作环境的相应资源
    prototype 的ajax
    即时点选的菜单
    如何禁止一个输入框输入
    基于jQuery的仿FLASH 菜单
  • 原文地址:https://www.cnblogs.com/borter/p/9413638.html
Copyright © 2011-2022 走看看