一个小C库-创新互联

#include#include#define true 1
#define false 0
#define bool _Bool
#define _Bool bool
#define and    &&
#define and_eq &=
#define bitand &
#define bitor  |
#define compl  ~
#define not    !
#define not_eq !=
#define or     ||
#define or_eq  |=
#define xor    ^
#define xor_eq ^=
#define INT_MAX 2147483647
#define INT_MIN -2147483648
#define LONG_INT_MAX 9223372036854775807
#define LONG_INT_MIN -9223372036854775807
#define PI_2 3.14
#define PI_4 3.1415
#define PI_7 3.1415926
#define PI_13 3.1415926535897
#define PI_20 3.14159265358979655845
typedef const char* Errtype;
const Errtype InputError = "InputError";
const Errtype OutputError = "OutputError";
const Errtype IndexError = "IndexError";
const Errtype NameError = "NameError";
const Errtype TypeError = "TypeError";
const Errtype SyntaxError = "SyntaxError";
const Errtype IncludeError = "IncludeError";
const Errtype SystemError = "SystemError";
const Errtype UnicodeError = "UnicodeError";
const Errtype ValueError = "ValueError";
const Errtype Exit = "Exit";
struct Fraction{
    int Denominator;
    int Molecule;
};
struct ListNode{
    int Value;
    struct ListNode *Prev;
    struct ListNode *Next;
};

double FractionToDouble(struct Fraction Fract) {
    return (double)Fract.Denominator / (double)Fract.Molecule;
}

FILE* WriteTo(char *Filename){
    return freopen(Filename, "w", stdout);
}

FILE* ReadFrom(char *Filename){
    return freopen(Filename, "r", stdin);
}

void CloseFile(FILE *File){
    fclose(File);
}

void Int_Input(int* Val){
    int s = scanf("%d", Val);
    if(!s){
        printf("Scanned {errtype InputError}, trying to fixed……");
        Int_Input(Val);
    }
}

void String_Input(char* Val){
    int s = scanf("%s", Val);
    if(!s){
        printf("Scanned {errtype InputError}, trying to fixed……");
        String_Input(Val);
    }
}

void Int_Output(int Val){
    int s = printf("%d\n", Val);
    if(!s){
        printf("Scanned {errtype OutputError}, trying to fixed……");
        Int_Output(Val);
    }
}

void String_Output(char *Val){
    int s = printf("%s\n", Val);
    if(!s){
        printf("Scanned {errtype OutputError}, trying to fixed……");
        String_Output(Val);
    }
}

const void* Max(const void* Val1, const void* Val2){
    return Val1 >Val2 ? Val1 : Val2;
}

const void* Min(const void* Val1, const void* Val2){
    return Val1< Val2 ? Val1 : Val2;
}

int Compare(const void* Val1, const void* Val2){
    if(Val1 == Val2){
        return 0;
    }
    return Val1 >Val2 ? 1 : -1;
}

void Reverse(int *List, int From, int To){
    for(int i=From;i<=To;i++){
        int tmp = List[i];
        List[i] = List[To-i];
        List[To-i] = tmp;
    }
}

long long QuickPower(long long Base, long long Index){
    long long result = 1;
    while(Index >0){
        if(Index & 1) result = result * Base % LONG_INT_MAX;
        Index >>= 1;
        Base = Base * Base % LONG_INT_MAX;
    }
    return result;
}

void QuickSort(int *Number, int First, int Last) {
    int i, j, pivot;
    int temp;
    if (FirstNumber[pivot])
                j--;
            if (iStr2[i])c1++;
            if(Str1[i]< Str2[i])c2++;
        }
        if(c1 >c2)return 1;
        if(c1< c2)return -1;
        return 0;
    } else {
        if(l1>l2){
            return 1;
        }
        if(l1Next = This;
        }
        This->Value = i;
        This->Prev = prev;
        This->Next = NULL;
        prev = This;
    }
    return head;
}

struct ListNode* Push_ListNode(struct ListNode *Head, int Value){
    struct ListNode *This = Head;
    while (This->Next != NULL) {
        This = This->Next;
    }
    struct ListNode *Next = (struct ListNode*)malloc(sizeof(struct ListNode));
    Next->Value = Value;
    Next->Next = NULL;
    Next->Prev = This;
    This->Next = Next;
    return Head;
}

struct ListNode* Pop_ListNode(struct ListNode *Head, int Index){
    struct ListNode *This;
    int idx=0;
    while (This->Next != NULL && idx< Index) {
        This = This->Next;
    }
    This->Prev->Next = This->Next;
    This->Next->Prev = This->Prev;
    free(This);
    return Head;
}

int Length_ListNode(struct ListNode *Head){
    struct ListNode *This = Head;
    int count=0;
    while (This->Next != NULL) {
        count++;
        This = This->Next;
    }
    return ++count;
}

int Find(int *List, int Value, int Size){
    int Flag = 0;
    while(List[Flag++]!=Value&&FlagValue == Value){
            count++;
        }
        This = This->Next;
    }
    return count;
}

void List_Output(int *List, int From, int To){
    for(int i=From;i9){
            continue;
        }
        Num += this*This;
        This *= 10;
    }
    return Num;
}

int Find_AscList(int *List, int Size, int Target){
    int left = 0, right = Size - 1, mid = (right + left) / 2;
    while (left< right && List[left] != List[right]) {
        if (List[mid] >= Target) {
            if (right == mid) right--;
            else right = mid;
        } else {
            if (left == mid) left++;
            else left = mid;
        }
        mid = (right + left) / 2;
    }
    if (List[mid] != Target) left = -2;
    return left+1;
}

int Find_DescList(int *List, int Size, int Target){
    Reverse(List, 0, Size+1);
    int answer = Find_AscList(List, Size, Target);
    Reverse(List, 0, Size+1);
    return answer;
}

char* IntegerToString(int Number){
    static char StrNum[1024] = {0};
    int Tail = 0;
    while(Number)StrNum[Tail++] = Number % 10 + '0',Number = Number / 10;
    return StrNum;
}

#define Exit() Throw(Exit)

你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧

你所需要的网站建设服务,我们均能行业靠前的水平为你提供.标准是产品质量的保证,主要从事网站建设、成都网站建设、企业网站建设、手机网站开发、网页设计、成都品牌网站建设、网页制作、做网站、建网站。创新互联拥有实力坚强的技术研发团队及素养的视觉设计专才。
文章题目:一个小C库-创新互联
文章网址:http://ybzwz.com/article/ipssc.html