CPP基础练习
业余选手李主任
功不唐捐,玉汝于成
展开
-
重载运算符练习
本文将实现复数类的各种运算符重载。Complex.h:#include <iostream>using namespace std;class Complex { friend ostream &operator<< (ostream &os, const Complex a); public: Complex operator+(const Complex &add);原创 2016-06-02 21:04:29 · 353 阅读 · 0 评论 -
STL练习题:Delivery
Description 快递公司在运送货物的时候,会通过机器扫描得到货物信息。但由于网络问题或重复扫描等问题,会产生冗余信息。现在需要根据接收到的信息,进行整理并按时间排序,去除掉多余信息。信息方式:YYYY/MM/DD-HH:mm:ss|快递信息要求保留某“快递信息”最早记录。按时间顺序进行排序。月:1-12日:1-30时:0-23分、秒:0-59输出格式YYYY/MM/DD-HH:mm:ss原创 2016-06-03 20:51:09 · 982 阅读 · 0 评论 -
函数模板练习题——template cmp
Description:Haoran is a “huge god” who loves C++ so much.One day he wants to implement a template function cmp which compares any type of two elements.Now he passes the mission to you all and hopes you原创 2016-06-09 20:03:14 · 1212 阅读 · 0 评论 -
类模板练习题——Template Arithmetic
Description:In this exercise, you are required to implement a template Arithmetic, which takes two parameters of type int,double,float, and then provides four kinds of operations including addition, s原创 2016-06-09 20:05:49 · 433 阅读 · 0 评论 -
Stack with Template
RequirementIn this assignment, you are required to finish the Stack with Template. Please modify class Stack’s declaration and definition so as to finish the validation from main.cppAttention: please u原创 2016-06-09 21:31:07 · 605 阅读 · 0 评论 -
Queue with Template
DescriptionPlease modify class Queue’s declaration and definition so as to finish the test from main.cpp…Attention: please use template you have learned in the class to finish this assignmentHere is my原创 2016-06-09 21:34:03 · 487 阅读 · 0 评论 -
C++抽象类练习题——games
Description:In this problem, you should complete some classes.You can see more details in sample input / output and main.cppEach gameobject will have position,speed, and 10HP.When you select a gameobje原创 2016-06-05 18:56:04 · 1026 阅读 · 0 评论 -
抽象工厂模式Abstract Factory
抽象工厂模式是所有形态的工厂模式中最为抽象和最具一般性的一种形态。抽象工厂模式是指当有多个抽象角色时,使用的一种工厂模式。抽象工厂模式可以向客户端提供一个接口,使客户端在不必指定产品的具体的情况下,创建多个产品族中的产品对象。Java的抽象工厂模型:abstract class AbstractProductA{ public abstract void operationA1();原创 2016-06-05 19:09:11 · 259 阅读 · 0 评论 -
继承练习题Collection with Inheritance
AssignmentAs we all know Java is a pure obejct oriented programming language and it also provide polymorphism.In JDK(1.7) architecture, java has its standar container classes. We can have a snapshot wi原创 2016-06-05 19:20:10 · 631 阅读 · 0 评论