In this article I am going to show you how to get TypeScript installed on your computer and how to write some simple programs using TypeScript. …
In this article I’m going to demonstrate another way to implement the Input and Process Until Done template using the
do-while statement. The major difference between the
while statement and the
do-while statement is that with the
do-while statement the condition is tested at the bottom of the loop instead of at the top as it is with the
Here is the pseudocode for this template:
Repeat the following until finished:
Read a value
Process the value
An example, which I’ll demonstrate using a
do-while statement below, is to determine the average grade on a test by inputting…
In this article, I discuss the next major construct in C — the loop. I’ll start by introducing a new program template related to loops, the Input and Process Until Done template, and then I’ll demonstrate how to implement this template using one C looping construct — the
One of the most common things you do in a computer program is repeatedly as the user for data and process that data until there is no more data to input. The Input and Process Until Done template provides an outline for how to write the code for this task.
As with my previous articles, I’ll be counting the frequency of words used in the classic essay “A Modest Proposal” by Jonathan Swift.
If you’ve taken a programming course in high school or college, or keep up with the programming literature, you’ve already been introduced to the concept of…
This is the second part of a two-part series on implementing the Select from Alternatives template in C. In this part I’ll discuss nested
if statements, the Boolean operators, and the
Sometimes, you need to nest
if statements inside other
if statements to best express the logic of a program solution. This can be a tricky technique and you need to approach nested
if statements carefully and debug them thoroughly.
When I talk about nested
if statements I’ll refer to an outer
if and inner
if statements. …
There is much controversy about the proper footfall when running. Some experts say it’s best to land on your forefoot. Other experts say you should land on your midfoot. And while not many experts say it’s OK to land on your heel, some experts say that heel striking really isn’t so bad.
I am currently reading a book titled, The Lost Art of Running by Shane Benzie and Tim Major. Benzie is a running coach whose expertise is running form. In his book, he writes about every aspect of running form but I am…
This article and my previous articles are all based on the book Exercises in Programming Style by Cristina Videira Lopes.
The best analogy for the Pipeline style is a factory pipeline, such as the ones used in the automobile industry. Cars are assembled piece by piece along a “conveyor belt” where there…
If you are interested in learning more about programming styles, I highly recommend the book that is the inspiration for my articles: Exercises in Programming Style by Cristina Videira Lopes.
The monolithic style of programming involves writing a complete program using no functions, no procedures, or any other tool or technique for modularizing the program. The Cookbook…
One of the most important program templates you can learn is the Select from Alternatives template. This template is used when a program needs to make decisions about what code to execute by choosing among different alternatives. An example of this is a payroll program that has to decide whether to pay an employee straight time or overtime based on the number of hours the employee worked during that pay period.
The Select from Alternatives template is implemented using one of two C constructs. In this article I’ll discuss the first of these constructs — the if statement. …
In this article I’ll introduce you to C’s arithmetic operators along with some other operators that make programming in C easier. I’ll start with arithmetic. At the end of the article, I’ll write two programs that utilize the Input, Process, Output template to demonstrate what was covered.
C’s arithmetic operators are:
These operators have an order of precedence where modulus, division, and multiplication have a higher precedence than addition and subtraction. You can modify the order of precedence by using parentheses, which have the highest…