C++ operators 辅导讲解、C++讲解辅导、C++程序辅导讲解

- 首页 >> C/C++编程


Requirements

Write a class that represents a fraction number like 2/3.

Functions below have to be implemented for this class:

default ctor

ctor takes two integers as parameters

copy ctor

arithmetical operators: + - * /

relational operators: < <= == != >= >

type cast to double

to string

inserter and extractor for streams

from a finite decimal string like: 1.414

Evaluation standard

1.c++ code quality (clean, compact and reasonable)

2.comments quality

Files to submit

Please prepare a .zip package including the following items:

1.the source code (including the Fraction class, and some typical usages for test)

2.makefile (for Mac or Linux users) or .exes (for Windows users) or CMakeLists.txt


站长地图