自定义新数据类型:INT类型1.0

/*
	说明:
	
	一. 定义
	
	定义时只能形如
	
	INT a,b;
	INT a;INT b; 
	
	这样定义,不能边定义边赋值,如: 
	
	INT a=3;
	
	这样不行! 
	
	
	二. 运算
	
	支持大部分运算,包括:
	
	+ - * / += -= *= /= << >> <<= >>= & | ^ ! ~ &= |= ^= % %= = <= < >= > == != ++ --
	
	
	三. 输入
	
	用cin或scanf输入,请输入该变量的.val
	
	即为:
	
	INT a;
	scanf("%d",&a.val);
	cin>>a.val;
	
	
	四. 输出
	
	用cout或printf输出,请输出该变量的.val
	
	INT a;
	printf("%d",&a.val);
	cout<<a.val<<endl;
	
	
	五. 数据类型
	
	默认数据范围为int,如要将其调整为其它数据类型, 
	请自行改动或打开namespace开头的define和末尾的undef 
	
	
	六. 函数
	
	如要调用系统函数,则请自行将函数参数调为.val 
	如要调用自己的函数,可以直接操作
	
	
	七. 模数
	
	如要在使用时Mod,请自行打开取模语句并自行更改Mod
	
	
	八. 精度问题
	
	在使用除法运算的时候,注意除法除出的精度,精度自行更改 
	
	 
	*/
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
//Mint:New_INT 1.0
namespace Mint
{
   
	const int Mod=1e9+7;
//	#define int long long
//	#define int double
//	#define int long double
//	#define int float
//	#define int long
//	#define int short int
//	#define int unsigned int
//	#define int unsigned long
//	#define int unsigned long long 
	struct INT{
   
		int val;
		
		INT operator=(const INT&);
		INT operator=(const int&);
		INT & operator++();
		INT operator++(int);
		operator int(){
   return val;}
		friend INT & operator--(INT & );
		friend INT operator--(INT & ,int);
		INT operator+=(const INT&);
		INT operator+=(const int&);
		INT operator-=(const INT&);
		INT operator-=(const int&);
		INT operator*=(const INT&);
		INT operator*=(const int&);
		INT operator/=(const INT&);
		INT operator/=(const int&);
		INT operator>>=(const INT&);
		INT operator>>=(const int&);
		INT operator<<=(const INT&);
		INT operator<<=(const int&);
		INT operator%=(const INT&);
		INT operator%=(const int&);
		INT operator&=(const INT&);
		INT operator&=(const int&);
		INT operator|=(const INT&);
		INT operator|=(const int&);
		INT operator^=(const INT&);
		INT operator^=(const int&);
	};
	
	//< > <= >= == !=
	
	
	//INT->INT
	bool operator<(const INT &a,const INT &b)
	{
   
		return a.val<b.val;
	}
	bool operator>(const INT &a,const INT &b)
	{
   
		return a.val>b.val; 
	}
	bool operator<=(const INT &a,const INT &b)
	{
   
		return a.val<=b.val;
	}
	bool operator>=(const INT &a,const INT &b)
	{
   
		return a.val>=b.val; 
	}
	bool operator==(
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值