Coder Social home page Coder Social logo

learning-c-and-cpp's Introduction

Learning-C-and-CPP

This repository contains some of the programs I am developing while learning C and C++ in school and online.

Compiling and Running

To compile the file, g++ <filename.cpp>

This compiles to a a.exe file

To run the file ./a.exe

To compile with a custom executable file name, g++ -o <customname.exe> <filename.cpp>

PROJECT A: ROCK, PAPER, SCISSORS ++

Program 1: Rock, Paper, Scissors, Go!

I made the standard version of Rock, Paper, Scissors(RPS)

The code is here'

The rules are simple:

  1. There are 3 options(1 to 3)
  2. You can only pick one option during a match
  3. When prompted, you will enter its number into the console

The options and their abilities are:

  1. Rock - Crushes Scissors
  2. Paper - Covers Rock
  3. Scissors - Cuts paper

Program 2: Rock, Paper, Scissors + Lizard + Spock (EXTENDED)

The RPSLS image

This is a basic but extended version of RPS based on notes from Sam Kass.

The code is here

It introduces Lizard and Spock to the standard version.

The rules stay the same but there are 2 additional options and abilities: 4. Lizard - Poisons Spock and eats Paper 5. Spock - Smashes Scissors and vaporizes Rock

Program 3: Rock, Paper, Scissors + Lizard + Spock (EXTENDED; Even Further Using Class)

For the third version of the game, I switched up gears a bit and split it into 3 files:

  1. The main file which initializes the game and starts it. (13 lines of code)
  2. The header file which contains the class definition and the class members' declaration. (26 lines of code)
  3. The logic file Where the game logic is coded. Also where the class member methods declared in the header file are defined. (351 lines of code)

390 total lines of code

I also moved the code to its own folder to make it easier to differentiate from the second version(Program 2).

Program 4: Extended RPSLS GUI

This is the fourth and last version of the game. It has a GUI that allows players to either type in their choice or click on an interactive graphic on their screen.

I haven't yet got to learning GUI with C/C++. Once I have, I will upload the code for Program 4.

I will also add comments to the code when I have time

learning-c-and-cpp's People

Contributors

newton-musyimi 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.