Coder Social home page Coder Social logo

iseven's Introduction

The Ultimate isEven()!

Have you ever wondered if a number is even or odd? Well, those times are over! With this implementation of isEven() you can once and for all determine if a number is even! And it doesn't end here! I also included isOdd() so you can be 100% sure when a number is odd!

Contents

Installation

  1. Clone this repository (if you haven't done so already).
git https://github.com/Roiqk7/isEven
  1. Default isEven.cpp supports integers from -600420 to 600420 (because GitHub doesn't allow for larger files). If that's fine with you, you can stop there. Otherwise, if you want more integers, follow the rest of this tutorial.
  2. Open your terminal.
  3. Go into the repo directory.
  4. Run python3 build.py. That will make isEven.cpp support integers all the way up to 100 million. This action takes around 1 minute on MacBook M2. To learn how to change this ceiling, click here!
  5. Everything is set and done!

How to use?

For example, usage refers to example.cpp.

How to use example.cpp

  1. Follow the steps in Installation (if you haven't done so already).
  2. Open your terminal.
  3. Go into the repo directory.
  4. Run g++ -std=c++17 -o example example.cpp isEven.cpp isOdd.cpp evenVector.cpp && ./example
  5. Find out if your favorite number is even or odd!

Changing max supported value

How do I change the ceiling of isEven.cpp? Easily!

  1. Open build.py in your text editor of choice.
  2. At line 8, notice the variable totalIterations.
  3. Change it's value to whatever you deem necessary!

Description

This repository is mainly used to determine if a number is even or odd using isEven() function defined in isEven.cpp and isOdd() function defined in isOdd.cpp. These functions then store a LOT of numbers to check whether the desired number is even or odd. Keep in mind that the functions only support numbers defined within them.

Also we have EvenVector class which adds a simple to use data structure to determine if a number is even or odd. Simply use the overloaded [] operator with a number you want to know is even or not and a proper boolean value will be returned to you as output.

Going over a BILLION...

Well... it's not really recommended. Look at the image bellow to see exactly how totalIterations = 1 Billion is large. Also, it takes around 10 minutes to build. I tried rewriting build.py in C++, but it didn't improve the performance at all.

Startup

iseven's People

Contributors

roiqk7 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.