Giter Site home page Giter Site logo

fraction_b's Introduction

Fraction

Write a class named Fraction that represents a fraction of two integers. Overload the following operators for this class:

  • The + operator to add two fractions and return their sum as another fraction in reduced form.
  • The - operator to subtract two fractions and return their difference as another fraction in reduced form.
  • The * operator to multiply two fractions and return their product as another fraction in reduced form.
  • The / operator to divide two fractions and return their quotient as another fraction in reduced form.
  • The == operator to compare two fractions for equality and return true or false.
  • All comparison operations (>,<,>=,<=)
  • The ++ and -- operator that adds (or substracts) 1 to the fraction. implement both pre and post fix.
  • The << operator to print a fraction to an output stream in the format “numerator/denominator”.
  • The >> operator to read a fraction from an input stream by taking two integers as input.
  • All operators should work on both sides on fractions and floats type variables. on a float var you need use up to 3 digits beyond the desimal point for acuracy.

דוגמאות לפעולת המחלקה ניתן למצוא ב-Demo.cpp.

בשלב א עליכם לכתוב כותרות ובדיקות-יחידה מקיפות.

כיתבו את כל הקבצים הדרושים כך שהפקודות הבאות יעבדו ללא שגיאות:

make demo && ./demo
make test && ./test

מומלץ גם להריץ:

make tidy
make valgrind

שימו לב: אין לשנות קבצים קיימים, אלא רק להוסיף קבצים חדשים. מערכת הבדיקה האוטומטית מעתיקה מחדש את כל הקבצים הקיימים על-גבי הפתרון שאתם מגישים, ולכן כל שינוי שתעשו בקבצים הקיימים יימחק.

בהצלחה

fraction_b's People

Contributors

rotshira avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.