LintCode (9)Fizz Buzz

下面是AC代码,C++风格:
class Solution {
public:
vector<string> fizzBuzz(int N) {
vector<string> Answer;
for(int i = ;i <= N;i++) {
if(i % == ) {
Answer.push_back("fizz buzz");
} else if(i % == ) {
Answer.push_back("fizz");
} else if(i % == ) {
Answer.push_back("buzz");
} else{
Answer.push_back(to_string(i));
}
}
return Answer;
}
};
此处很奇怪,为何将成员函数名fizzBuzz的首字母改成大写,编译返回不通过?
Main.cpp: In function ‘int main()’:
Main.cpp:26:39: error: ‘class Solution’ has no member named ‘fizzBuzz’
vector results = solution.fizzBuzz(n);
^
EXITCODE=1
LintCode (9)Fizz Buzz的更多相关文章
- Lintcode 9.Fizz Buzz 问题
------------------------ AC代码: class Solution { /** * param n: As description. * return: A list of s ...
- LintCode: Fizz Buzz
C++ class Solution { public: /** * param n: As description. * return: A list of strings. */ vector&l ...
- [容易]Fizz Buzz 问题
题目来源:http://www.lintcode.com/zh-cn/problem/fizz-buzz/
- [LeetCode] Fizz Buzz 嘶嘶嗡嗡
Write a program that outputs the string representation of numbers from 1 to n. But for multiples of ...
- LeetCode 412. Fizz Buzz
Problem: Write a program that outputs the string representation of numbers from 1 to n. But for mult ...
- LeetCode Fizz Buzz
原题链接在这里:https://leetcode.com/problems/fizz-buzz/ 题目: Write a program that outputs the string represe ...
- Fizz Buzz
class Solution { public: /** * param n: As description. * return: A list of strings. */ vector<st ...
- [重构到模式-Chain of Responsibility Pattern]把Fizz Buzz招式重构到责任链模式
写一段程序从1打印到100,但是遇到3的倍数时打印Fizz,遇到5的倍数时打印Buzz,遇到即是3的倍数同时也是5的倍数时打印FizzBuzz.例如: 1 2 Fizz 4 Buzz Fizz 7 8 ...
- Swift完成fizz buzz test
看到一篇文章上说,很多貌似看过很多本编程书的童鞋连简单的fizz buzz测试都完不成. 不知道fizz buzz test为何物的,建议自行搜之. 测试要求是,编写满足以下条件的代码: Write ...
随机推荐
- MySQL半同步Semi-sync原理介绍【图说】
上图先.
- HMM模型详解
http://www.cnblogs.com/skyme/p/4651331.html
- 5.7 cm server-agent 会出现无法启动
异常信息如下: 离线安装cloudera-scm-agent5.7的Unable to create the pidfile问题 在离线安装Cloudera Manager启动agent出现了如下异常 ...
- Python的基础--对象
对象(Objects)是python中数据的抽象,python中所有的数据均可以用对象或者是对象之间的关系来表示.每个对象均有标识符(identity).类型(type).值(value). 标识符. ...
- mysql优化方案总结
u Mysql数据库的优化技术 对mysql优化时一个综合性的技术,主要包括 a: 表的设计合理化(符合3NF) b: 添加适当索引(index) [四种: 普通索引.主键索引.唯一索引u ...
- linux 机器出现or type control d to continue问题的处理办法
当出现这个界面时,主要是因为磁盘问题 直接输入root密码进入修复模式 在命令行下执行fsck命令 进行相关挂载目录或是磁盘的修改 看下 /etc/fatab下是否有 自己加的开机自动挂载的目录 ,看 ...
- 001OC的结构解析
Xcode通过.m扩展名来表示文件使用的是OC代码,C编译器处理.c文件,c++编译器处理cpp文件.所有编译工作默认由LLVM处理,这个编译器能够理解C语言的全部3个变体. #import<F ...
- Memcached管理与监控工具 memAdmin
http://www.junopen.com/memadmin/ 使用MemCached以后,肯定希望知道cache的效果,对于MemCached的一些运行状态进行监控是必要的,memcached提供 ...
- android基础4——Mainifest
众所周知,应用程序中的每一个UI都是通过Activity类的一个或者多个拓展实现的.在桌面开发环境中,Activity相当于Form,来布局和显示信息,以及影响用户的动作.Mainifest可以定义应 ...
- mysql中timestamp,datetime,int类型的区别与优劣
转载请注明来自 souldak,微博: @evagle 以下内容 整合筛选自互联网: int 1. 占用4个字节 2. 建立索引之后,查询速度快 3. 条件范围搜索可以使用使用between 4. 不 ...