码风

· · 个人记录

VS:

main

#include <iostream>
#include "head_1.h"
#include "head_2.h"
#include "head_3.h"
using namespace std;
__int32 main ( ) {
    /*__int32 a = IN::READS ( );
    printer.print ( a );
    printer.print ( "\n" );*/
    system ( "pause" );
    return 0;
}

head_1:

#pragma once
#include <iostream>
#include <string>
using namespace std;
namespace equ {
    double add ( double a , double b ) {
        return a + b;
    }
    double sub ( double a , double b ) {
        return a - b;
    }
    double mul ( double a , double b ) {
        return a * b;
    }
    double div ( double a , double b ) {
        return a / b;
    }
    double mod ( double a , double b ) {
        return a - a / b * b;
    }
    double auto_inc ( double a ) {
        return a + 1;
    }
    double auto_dec ( double a ) {
        return a - 1;
    }
}

head_2

#pragma once
#include <iostream>
#include <string>
#include <cstdio>
#include <sstream>

class SafePrinter {
    public:
    template<typename T>
    void print ( const T &value ) {
        std::ostringstream oss;
        oss << value;
        printf ( "%s" , oss.str ( ).c_str ( ) );
    }
    void print ( const std::string &str ) {
        std::printf ( "%s" , str.c_str ( ) );
    }
    void print ( const char *str ) {
        std::printf ( "%s" , str );
    }
};
SafePrinter printer;

head_3:

#pragma once
#include <iostream>
#include <string>
class IN {
    public:
    template<typename T>
    static T READC ( ) {
        T value;
        std::cin >> value; 
        return value;
    }

    static int READS ( ) {
        __int32 value;
        scanf_s ( "%d" , &value ); 
        return value;
    }
};

DEV(老式马蜂):

#include <bits/stdc++.h>
using namespace std;

inline long long inputI( )
{
    long long x = 0, f = 1; char ch = getchar( );
    while( ch < '0' || ch > '9' )
    {
        if ( ch == '-' )
           f = -1;
        ch = getchar( );
    }
    while( ch >= '0' && ch <= '9' )
    {
        x = x * 10 + ch - '0';
        ch = getchar( );
    }
    return x * f;
}

int main( int argc, char *argv [ ] )
{
    return 0;
}