UNIX和Windows中的代码(无符号int值问题) [英] code in unix and windows (unsigned int value problem)

查看:69
本文介绍了UNIX和Windows中的代码(无符号int值问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

int main(int argc, char* argv[])
{
  unsigned long long x=atoi(argv[1]);
  unsigned long long y=atoi(argv[2]);
  if(x>0 && x<=4294967295 && y>0 && y<=4294967295)
  {
    cout<<"done";
  }
  else
  {
    cout<<"not done";
  }
  return 0;
}



但是,当我插入x = 6543848485或大于2254354363(10位数)的任何值时,它会自动采用x = 2147483647(自动)的默认值.我不知道为什么而不要进入else条件.

但是当我在Windows中运行此代码时,即在dev-cpp中它正在运行.但我想在Unix中运行它.

help



But when i insert x=6543848485 or any value greater than 2254354363(10 digit), it is automatically taking the default value of x=2147483647(automatically). I don''t know why? and not entering in the else condition.

But when i run this code in windows i.e. in dev-cpp it is running. but i want to run it in unix.

help

推荐答案

一个小时前问这个问题时,您就得到了答案. 采用unix中unsigned long int的默认值 [ ^ ]

答案没有改变,因为您再次发布了它.

返回,阅读答案,然后从那里走-不要重新发布您的问题,如果您不明白,请寻求答案的澄清.
When you asked this question an hour ago, you got answers. taking default value of unsigned long int in unix[^]

The answer hasn''t changed because you post it again.

Go back, read the answers and go from there - do not re-post your question, aask for clarification of an answer if you don''t understand it.


这篇关于UNIX和Windows中的代码(无符号int值问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆