急求C++解答@!!!!!多谢!

[复制链接]
查看11 | 回复2 | 2010-6-2 19:01:11 | 显示全部楼层 |阅读模式
#include
void main ()
{ //计算a 的位数

int a;int i=1;
cin>>a;

while((a/=10)!=0)
i++;
coutusing namespace std;int main(){ int intMax = numeric_limits::max(); int intMin = numeric_limits::min(); float floatMax = numeric_limits::max(); float floatMin = numeric_limits::min(); cout << intMax << " " << intMin << endl; cout << floatMax
回复

使用道具 举报

千问 | 2010-6-2 19:01:11 | 显示全部楼层
发生溢出,坚定完毕,把int i=1;改成 long i=1;int只能存10位// cuowu2.cpp : Defines the entry point for the console application.//#include "stdafx.h"int main(int argc, char* argv[]){
回复

使用道具 举报

千问 | 2010-6-2 19:01:11 | 显示全部楼层
因为int类型的范围有限
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行