All posts by Editor

Web Assignment Sample: Check for Balanced Parentheses in an Expression

Hello! In this guide, I’ll show you the program to check the balance of different types of parentheses in an expression using C++.

Idea for Implementation

Everything would be much simpler if we had to check only one type of parentheses. If it is required to check the balance of the parentheses of only one type, for example, “(“ and “)”, we can read all the symbols one by one, ignoring all the symbols except the braces. If it is an opening bracket we increase the counter by 1, and if it’s a closing bracket we reduce the counter by one. After the check, it’s easy to define if the expression is balanced. If the counter is bigger than zero, we have more opening brackets. But if it goes lower than zero, we can’t check further. So we will use the stack. Continue reading

C# Programming Samples: Snake Game

Long ago, when monitors were black and green and computers had 64 kilobytes RAM, the legendary game was created. It was called “Snake” and it still has a lot of clones on different devices: from desktop to smartphones and tablets. But the original textual implementation hasn’t been used for years. So in this guide, I want to show you the canonical implementation of the legendary game.

skake-game-in-c-1 Continue reading

Sample Projects in C#: Consecutive Numbers in Gray Code Sequence

Consecutive Numbers in Gray Code Sequence

  • The reflected binary code (RBC), also known as Gray code after Frank Gray, is a binary numeral system where two successive values differ in only one bit (binary digit). The reflected binary code was originally designed to prevent spurious output from electromechanical switches. Today, Gray codes are widely used to facilitate error correction in digital communications such as digital terrestrial television and some cable TV systems. (en.wikipedia.org, 2002)

Continue reading

GLSL Shader Examples: Blue Color Screen

GLSL TASK:

Create a shader which fills the screen with blue color. For the space occupied by right half of screen, introduce a vertical green bar located in the middle of it, with its width being equal to one-third of it. This should result in right half of screen being divided into three equal parts (blue-green-blue). As for the left half of screen, introduce a pair of vertical red bars, with width of each being equal to one-fourth of it, resulting in left half of screen being divided into four equal parts (blue-red-blue-red). Continue reading