Skip to content

Egahi/Parity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parity

Parity "is the property of an integer of whether it is even or odd. An integer is even if it is a mulitple of two, and odd if it is not." - Wikipedia

This program prompts the user to enter a number. Then, it checks if the number is even or odd and prints out the appropriate message.

However, the program has some some syntatic and logical errors (bugs) and that's where you come in. You are to identify and fix the bugs to make the program work correctly.

Objectives

  • To practice identifying and fixing bugs in a simple C++ program.
  • To gain familiarity with the syntax and structure of C++ programs.
  • To develop critical thinking skills and problem-solving strategies for debugging code.

Background

"A software bug is an error, flaw or fault in the design, development, or operation of computer software that causes it to produce an incorrect or unexpected result, or to behave in unintended ways. The process of finding and correcting bugs is termed 'debugging' and often uses formal techniques or tools to pinpoint bugs" - Wikipedia

In C++ the common types of erros you would encounter are Syntax, logical, semantic, linker and run-time errors. You can read more about them here For this challenge, we'll focus on syntax and logical errors.

Syntactic errors refer to mistakes in the grammar or syntax of C++ while logical errors, on the other hand, refer to mistakes in the algorithm or logic of the program.

Pre-requisite Knowlege

  • Git
  • C++ data types
  • C++ variables
  • C++ Operators

Getting Started

  1. Fork this repository to your github account.
  2. Clone it locally.
  3. Create and switch to a new branch in your local repo
  4. Open the solution in Visual Studio
  5. Fix the bugs in Parity.cpp
  6. Commit your changes to the new branch
  7. Push the new branch to your fork of the repo on github
  8. Create a pull request (pr) to merge your changes in to the main branch.

How to Test Your Code

The correct code should behave like these examples

image image

Duration

1 hour

Level

Beginner

Thematic Area

Programming and deugging in C++

Access & Resources

  1. C++ documentation
  2. Introduction to debugging
  3. Introduction to Git

Releases

No releases published

Packages

No packages published

Languages