Code Monkey home page Code Monkey logo

cplusplus's Introduction

C++ problem solutions

  • Create a function which returns a random choice of head or tail.
  • Get a guess from the user and print if he/she has managed to hit the random generated choice.
  • Generate 1000 random choices. Determine the ratio of heads.
  • How many times was "heads" chosen exactly twice after each other? For example: THHHHTTHHTHHHTHH -> 2
  • How long was the longest sequence of heads?

The lottery.txt file contains the lottery results back to 1957. The first line of the file contains a number which gives the number of further lines. Each line contains the numbers of a week in ascending order. The following tasks have to be solved based on this input file:

  • Read 5 numbers from the user, all of them should be between 1 and 90. Check if all numbers are from this interval.
  • Print these numbers in ascending order.
  • Determine based on the input file which number was pulled most times.
  • Create a function which requires two vectors of length 5. The function should return how many elements of the two vectors match.
  • Based on the input file let's determine how many times the user has 1, 2, 3, 4 or 5 matches if he or she played every week.

lottery.txt: http://bruntib.web.elte.hu/english_cpp/lottery.txt

cplusplus's People

Contributors

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