c++下无穷的使用

Xredman posted @ Mar 26, 2010 10:22:59 AM in Algorithm with tags c++ , 1755 阅读

 

#include <iostream>
#include <climits>
using namespace std;

int main()
{
	cout<<"INT_MAX: "<<INT_MAX<<endl;
	
	cout<<"INT_MIN: "<<INT_MIN<<endl;
	
	//最轻微的上溢是 INT_MAX+1,结果是INT_MIN
	cout<<"INT_MAX+1: "<<INT_MAX + 1<<endl;
	
	//最严重的上溢是 INT_MAX+INT_MAX,结果是 -2
	cout<<"INT_MAX+INT_MAX: "<<INT_MAX + INT_MAX<<endl;
	
	//最轻微的下溢是 INT_MIN - 1,结果是 INT_MAX
	cout<<"INT_MIN-1: "<<INT_MIN - 1<<endl;
	
	//最严重的下溢是 INT_MIN +INT_MIN,结果是 0
	cout<<"INT_MIN+INT_MIN: "<<INT_MIN + INT_MIN<<endl;
	return 0;
}
/*
INT_MAX:----------------------(2147483647)
INT_MIN:----------------------(-2147483648)
INT_MAX+1:--------------------(-2147483648)
INT_MAX+INT_MAX:--------------(-2)
INT_MIN-1:--------------------(2147483647)
INT_MIN+INT_MIN:--------------(0)
*/





  • 无匹配
spectrum.net activat 说:
Sep 03, 2023 11:02:30 PM

To start using your services right away from your mobile device, download the My Spectrum App. To activate your new Spectrum services using a web browser, go to spectrum.net/self install. Without a wireless connection, spectrum.net activate now you can use the Spectrum TV App and other TV channel apps while on the go. Nevertheless, if you are not connected to WiFi, mobile data tariffs can be in effect. While using the Spectrum TV app away from your home, channel availability could be restricted.

pavzi.com 说:
Jan 03, 2024 12:31:49 AM

Pavzi website is a multiple Niche or category website which will ensure to provide information and resources on each and every topic. Some of the evergreen topics you will see on our website are Career, Job Recruitment, Educational, Technology, Reviews and others. <a href="https://pavzi.com/">pavzi.com</a> We are targeting mostly so it is true that Tech, Finance, and Product Reviews. The only reason we have started this website is to make this site the need for your daily search use.

pavzi.com 说:
Jan 03, 2024 12:32:14 AM

Pavzi website is a multiple Niche or category website which will ensure to provide information and resources on each and every topic. Some of the evergreen topics you will see on our website are Career, Job Recruitment, Educational, Technology, Reviews and others. pavzi.com We are targeting mostly so it is true that Tech, Finance, and Product Reviews. The only reason we have started this website is to make this site the need for your daily search use.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter