zoukankan      html  css  js  c++  java
  • 程序的分界符‘{’和‘}’应独占一行并且位于同一列

    程序的分界符‘{’和‘}’应独占一行并且位于同一列,同时与引用 它们的语句左对齐。

     1 #include <iostream>
     2 #include <stdio.h>
     3 #include <string.h>
     4 #include <process.h>
     5 #include <stdlib.h>
     6 #define MAX    3
     7 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
     8 using namespace std;
     9 int main(int argc, char** argv) {
    10       //声明变量
    11     int i,n;
    12     FILE *fp1;                 // 声明文件指针变量
    13 
    14     //以写入方式打开d.dat文件
    15     if ((fp1=fopen("d.dat","w"))==NULL)
    16     {
    17        cout<<"
    Could not open the file."<<endl;
    18        cout<<"Exiting program."<<endl;
    19        exit(1);   //结束程序执行
    20     }
    21 
    22     // 写文件操作 
    23     for (i=1;i<=MAX;i++)  {     
    24         n=rand();        //产生1个整数随机数
    25         putw(n,fp1);
    26         cout<<n<<" ";
    27     }
    28     cout<<endl<<"--------------------"<<endl;
    29  
    30     fclose(fp1);                   //关闭文件
    31 
    32     // 以读方式打开d.dat文件
    33     if ((fp1=fopen("d.dat","r"))==NULL) 
    34     {
    35        cout<<"
    Could not open the file."<<endl;
    36        cout<<"Exiting program."<<endl;
    37        exit(1);   //结束程序执行
    38     }
    39   
    40     // 循环从"流"文件读取字符,并显示
    41     while ((n=getw(fp1))!=EOF)  
    42           cout<<n<<" ";        
    43 
    44     fclose(fp1); //关闭文件
    45     return 0;
    46 }
  • 相关阅读:
    二十一、Mysql之GTID
    二十、Mysql的过滤复制
    十九、Mysql的半同步复制
    十八、Mysql之延时从库
    十七、Mysql的主从(三)--主从故障监控分析
    抖音爬虫
    python 操作手机
    python sheet写入数据
    pandas用法大全
    caog
  • 原文地址:https://www.cnblogs.com/borter/p/9413290.html
Copyright © 2011-2022 走看看