全部问题 > 当前问题

int

#include<stdio.h>

#include<stdlib.h>

#include<time.h>

main()

{

int t,i,a,b;

time(&t);

srand(t);

a=rand()%100;

b=rand()%100;

printf("a=%d\nb=%d\n",a,b);

printf("a+b=%d",a+b);

}

这个程序报错为啥提示吧int换成long,才能运行??


带我走@ 2016-2-26 12:22:56

共 3 个回答

嘿嘿大人 2016-2-26 12:24:10

c文件的后缀是.c,你是不是吧.c写成了.cpp啊

带我走@ 2016-2-26 12:54:45

回复 嘿嘿大人:两者有很大区别吗


最佳答案

嘿嘿大人 2016-2-26 12:55:39

回复 带我走@:一个是c语言的后缀,一个是c++语言的后缀,你觉得区别大不大嘛

问题来自: 随机数