摘要:《C++编程——数据结构与程序设计方法》中的程序范例:影碟店。找不到附书光盘(有的能送个吗?),自己根据电子书调试通过的。可做为模板、链表及相关程序设计的参考。放到我上传的资源里了,需要的可到那里下载
阅读全文
摘要://==============================================================================//链表模板《C++编程——数据结构与程序设计方法》16.2作为抽象数据类型的链表//Header File:linkedList.h#ifndef _LINKEDLIST_H#define _LINKEDLIST_Htemplate<class Type>struct nodeType{Type info;nodeType<Type>* link;};template<class Type>clas
阅读全文
摘要://《C++编程——数据结构与程序设计方法》15.8.3#include<iostream>#include <string>#include "arrayListType.h"using namespace std;template<class elemType>arrayListType<elemType>::arrayListType(int size)//(int size=100)是错的??{if(size<0){cout<<"Thearray size must be positive
阅读全文
摘要://《C++编程——数据结构与程序设计方法》例15.8//利用函数重载技术,求两个整数、字符、浮点数或字符串中的较大值,需要编写4个函数larger。//而C++通过提供函数模板,简化了重载函数据的过程。#include <iostream>using namespace std;template<class Type>//Type,模板的形参,用于确定函数的形参,返回值类型,还用于在函数中声明变量。Type larger(Type x,Type y);int main(){cout<<"Line 1: Larger of 5 and 6 =&qu
阅读全文