list2.cpp
来自「c compiler with added projects...」· C++ 代码 · 共 35 行
CPP
35 行
// Borland C++ - (C) Copyright 1991 by Borland International
// list.cpp: Implementation of the List Class
#include <iostream.h>
#include "list2.h"
int List::put_elem(int elem, int pos)
{
if (0 <= pos && pos < nmax)
{
list[pos] = elem;
return 0;
}
else
return -1; // non-zero means error
}
int List::get_elem(int& elem, int pos)
{
if (0 <= pos && pos < nmax)
{
elem = list[pos];
return 0;
}
else
return -1; // non-zero means error
}
void List::print()
{
for (int i = 0; i < nelem; ++i)
cout << list[i] << "\n";
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?