IO Utility Functions
Use our IO functions and operators to do input and output over 40 times faster* and handle int128.
Example
fread+fwrite.h
Lists of functions:
- void init_output(void): must be called at the beginning of the program, it ensures the output is flushed at the end
- int read_int(void): used to read 1 32-bit integer
- char next_char(void): used to read 1 byte of data (a char)
- void write_char(char): used to write a single character to the output buffer
- void write_int(int): used to write a 32-bit integer and a newline (can be customized) to the output buffer
- void flush_out(void): used to flush the output buffer to the screen
int128.h
Lists of functions and operators:
- operator<<: writes one __int128 type to the output stream specified. Example:
out<<myint128variable; - operator>>: reads one __int128 type variable from the input stream specified. Example:
cin>>int128; - __int128 read(void): reads one __int128 type variable from
std::cinusinggetchar(), it is faster than the operator above, but limited to reading from standard input. - void print(__int128 x): writes one __int128 type variable to standard output using
putchar(). It is also faster than the operator but limited to standard output. - bool cmp(__int128,__int128): the compare function used in sorting __int128 arrays in descending order