GithubHelp home page GithubHelp logo

formula's Introduction

四則演算プログラム

環境

  • OS : Linux
  • コンパイラ : g++ (GCC) 8.2.1 20181127
  • その他ツール : make

ファイル

  • eval_formula.cpp , Formula.hpp : プログラムのソースコード
  • test.cpp : ユニットテスト用コード
  • Makefile : make用ファイル
  • README.md

ビルド方法

以下コマンドを実行すると実行ファイルevalfが生成される。
make

使用方法

以下のように引数に数式を渡す。
./evalf "-3+4"

仕様

使用可能文字

  • 演算子 : + , - , * , /
  • 符号 : + , -
  • 括弧 : ( , )
  • 数字 : 0 ~ 9
  • 空白 : ' '

符号

  • 演算子と符号は並べて利用可能。
    • 4--4 は 4-(-4) として解釈される。
  • 符号は2つ以上並べて利用不可。

  • 利用可能な整数は8桁まで。
  • 最大桁が0の整数は利用不可。
  • 間に空白を含む数は利用不可。

各種メッセージ

  • 「使用不可な文字が使われています。」
    • 使用可能文以外の文字が仕様されている場合に表示される。
  • 「不正な数が使われています。」
    • 9桁以上、もしくは先頭の桁が0の整数が使われている場合に表示される。
  • 「符号が2つ以上並んでいます。」
  • 「構文が間違っています。」
  • 「0除算が存在します。」
  • 「不明なエラーが発生しました。」
  • 「引数がありません。」

formula's People

Contributors

y0kuda avatar

Watchers

James Cloos 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.