pex13_2a.cpp

来自「数据结构C++代码,经典代码,受益多多,希望大家多多支持」· C++ 代码 · 共 38 行

CPP
38
字号
#include <iostream.h>
#pragma hdrstop

#include "strclass.h"
#include "toursort.h"

void main(void)
{

	// sort an array of String objects with values taken from str
	String strList[10];
	char *str[] = {"class", "object", "public", "private",
				   "derived", "base", "inherit", "method",
				   "constructor", "abstract"};

	// initialize strList
	for(int i=0;i < 10;i++)
		strList[i] = str[i];

	// sort the array of String objects and print
	// the sorted list
	TournamentSort(strList, 10);
	for(i=0;i < 10;i++)
	{
		cout << strList[i] << "  ";
		if (i == 4)
			cout << endl;
	}
	cout << endl;
}

/*
<Run>

abstract  base  class  constructor  derived
inherit  method  object  private  public
*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?