mirror of
https://github.com/wuye9036/CppTemplateTutorial.git
synced 2024-03-22 13:11:16 +08:00
修改例子
例中的find应该返回元素的index,所以其签名应该是 `int Find(T x)` 而不是`T Find(T x)`
This commit is contained in:
parent
9c34df8899
commit
5723b1bf1e
@ -600,7 +600,7 @@ class StackFloat
|
|||||||
public:
|
public:
|
||||||
void push(float v);
|
void push(float v);
|
||||||
float pop();
|
float pop();
|
||||||
float Find(float x)
|
int Find(float x)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < size; ++i)
|
for(int i = 0; i < size; ++i)
|
||||||
{
|
{
|
||||||
@ -634,7 +634,7 @@ class Stack
|
|||||||
public:
|
public:
|
||||||
void push(T v);
|
void push(T v);
|
||||||
T pop();
|
T pop();
|
||||||
T Find(T x)
|
int Find(T x)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < size; ++i)
|
for(int i = 0; i < size; ++i)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user