zoukankan      html  css  js  c++  java
  • 文件读写

    //============================================================================
    // Name        : goodmorning.cpp
    // Author      : byfei
    // Version     :
    // Copyright   : Your copyright notice
    // Description : chemical in C++, Ansi-style
    //============================================================================
    
    #include <iostream>
    #include <fstream>
    using namespace std;
    
    int main(int argc, char* argv[])
    {
    	if(argc < 2)
    	{
    		cout<<"Don`t input filename";
    		return 0;
    	}
    	FILE *fp = NULL;
    	if((fp = fopen(argv[1],"r")) == NULL)
    	{
    		cout<<"File could not be opened"<<endl;
    		return 0;
    	}
    	int test = 0;
    	if(fscanf(fp,"%d",&test) != 1)
    	{
    		fclose(fp);
    		return 0;
    	}
    	fclose(fp);
    
    	for(int i=1;i<=test;++i)
    	{
    		int nResult = i%24;
    		if(7<=nResult && nResult<=9)
    			cout<<"Good Morning"<<endl;
    		else
    			cout<<"hello"<<endl;
    	}
    	return 0;
    }
    
    
    

  • 相关阅读:
    ACM-ICPC 2018 南京赛区网络预赛 J.Sum
    汉诺塔
    汉诺塔
    D
    D
    数学小定理
    数学小定理
    Python index()方法
    Python endswith()方法
    Python encode()方法
  • 原文地址:https://www.cnblogs.com/byfei/p/14104348.html
Copyright © 2011-2022 走看看