problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
leetcode::base_7::Solution类 参考

#include <leetcode.h>

静态 Public 成员函数

static string convertToBase7 (int num)
 

详细描述

在文件 leetcode.h1572 行定义.

成员函数说明

◆ convertToBase7()

string leetcode::base_7::Solution::convertToBase7 ( int  num)
static

在文件 leetcode.cpp4046 行定义.

4046 {
4047 bool pos = true;
4048 if(num < 0) {
4049 pos = false;
4050 num = -num;
4051 }
4052 if(num == 0) {
4053 return "0";
4054 }
4055 deque<int> deq;
4056 while(num != 0) {
4057 deq.push_front(num % 7);
4058 num /= 7;
4059 }
4060 ostringstream oss;
4061 if(!pos) {
4062 oss << '-';
4063 }
4064 for(const int n: deq) {
4065 oss << n;
4066 }
4067 return oss.str();
4068 }

被这些函数引用 leetcode::base_7::TEST().


该类的文档由以下文件生成: