![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
单音GG
喜欢自学的编程爱好者,QQ:646585122
展开
-
游戏服务器gmID的生成
//平台id + 区服id + 秒级时间戳 + 自增id unsigned long long GetGmID(int platformId = 2, int areaId = 1) { static int index = 0; time_t nowTime = time(NULL); static time_t lastTime = time(NULL); unsigned long long gmid = platform...原创 2020-10-30 15:35:44 · 360 阅读 · 0 评论 -
自己实现字符串转int
std::string num = "770756"; int Number = 0; int x, y; if (num[0] == '-') { x = 1; y = num.length() - 2; for (; x < num.length(), y >= 0; x++, y--) { int NewNumber = num[x] - 48; Number +...原创 2018-05-16 18:32:09 · 240 阅读 · 0 评论 -
把C++的类,方法,成员,枚举转换成对应的字符串
std::string ConversionString;#define XToString(val) getString(#val)string & getString(const char * val) { ConversionString = val; return ConversionString;};原创 2018-09-07 20:10:38 · 2567 阅读 · 0 评论 -
C++ 改变控制台输出文字的颜色
#include <iostream>#include <windows.h>int main(){ HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE); HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE); WORD index = 0; C...原创 2018-09-03 12:11:43 · 2444 阅读 · 0 评论 -
C++ 实现string::format
class StreamBuffer{public: template <class ...Args> static std::string Format(Args &&... args) { ss.clear(); ss.str(""); int arr[] = { (printarg(args), 0).....原创 2018-11-29 11:41:05 · 4717 阅读 · 0 评论