/*
说明:
一. 定义
定义时只能形如
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==(
自定义新数据类型:INT类型1.0
最新推荐文章于 2022-04-09 19:09:16 发布