zoukankan      html  css  js  c++  java
  • 关于long long 的输入和输出

    long long 在Codeblocks 里可以正常的输入和输出,但是在VC里面就出问题了,会出现:

    binary '>>' : no operator defined which takes a right-hand operand of type '__int64' (or there is no acceptable conversion)

    的报错,并且关键字也不能写成long long的形式,这样也是会报错的,总之在VC里使用long long特别费劲

    VC:

    输出:printf("%I64d",s);

    输入:scanf("%I64d",&l);


    今天做一道水题又遇到问题了,由于蓝桥杯用的是DEV-C++,所以又一个编译器,就又产生问题了,首先

    codeBlock中:

    scanf("%lld",&n);

     printf("%lld",sum);//long long输出

    但是今天在做http://lx.lanqiao.org/problem.page?gpid=T2这道水的不行的题的时候,就用这种输入输出方式,结果就出错了,只能是用VC中的输入方式,也就是:

    输入:scanf("%I64d",&l);

    输出:printf("%I64d",s);

    所以为了以后避免错误,就直接用这种方式就行了



    题目代码:

    #include <stdio.h>
    
    int main()
    { 
    	long long  sum = 0, n = 0;  //__int64  long long型
     
    	scanf("%lld",&n);
    	sum = (n+1)*n/2;/////这里听短小精悍的
    	printf("%lld",sum);//long long输出
     
    	return 0;
    }


    
  • 相关阅读:
    Unix + OS IBM Aix System Director
    framework apache commons
    维吉尼亚密码
    破译换字式密码
    维吉尼亚密码表
    维吉尼亚密码表
    delete i;
    破译换字式密码
    破译换字式密码
    int *i = new int;
  • 原文地址:https://www.cnblogs.com/zswbky/p/5432100.html
Copyright © 2011-2022 走看看