📄 sorted.cpp
字号:
//: C16:Sorted.cpp
// From Thinking in C++, 2nd Edition
// at http://www.BruceEckel.com
// (c) Bruce Eckel 1999
// Copyright notice in Copyright.txt
// Testing template inheritance
#include <iostream>
#include <string>
#include "Sorted.h"
#include "Integer.h"
using namespace std;
char* words[] = {
"is", "running", "big", "dog", "a",
};
const int wordsz = sizeof words / sizeof *words;
int main() {
Sorted<string> ss;
for(int i = 0; i < wordsz; i++)
ss.add(new string(words[i]));
for(int j = 0; j < ss.count(); j++)
std::cout << ss[j]->c_str() << endl;
Sorted<Integer> is;
Urand<47> rand1;
for(int k = 0; k < 15; k++)
is.add(new Integer(rand1()));
for(int l = 0; l < is.count(); l++)
std::cout << *is[l] << endl;
} ///:~
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -