serna37's Library

Logo

C++ アルゴリズムとデータ構造のライブラリ

View the Project on GitHub serna37/library-cpp

:heavy_check_mark: 型変換
(library/various/convert.hpp)

型変換

できること

計算量

$O(1)$

使い方

そのままなので省略

Verified with

Code

#pragma once
char int_to_char(int x) { return (char)(x + '0'); }
char int_to_alph(int x) { return (char)(x + 'a'); }
int char_to_int(char c) { return (int)(c - '0'); }
string int_to_string(long long x) { return to_string(x); }
long long string_to_int(const string &s) { return stoll(s); }
#line 2 "library/various/convert.hpp"
char int_to_char(int x) { return (char)(x + '0'); }
char int_to_alph(int x) { return (char)(x + 'a'); }
int char_to_int(char c) { return (int)(c - '0'); }
string int_to_string(long long x) { return to_string(x); }
long long string_to_int(const string &s) { return stoll(s); }
Back to top page