Category: Programming

Programming contents including C++, Ruby and others.

Lesson 9 – Vectors

In the previous lesson, we learnt about arrays. Arrays are containers that store data. In order to declare an array, you need to specify what type of data it stores, and the array cannot...

Lesson 8 – Arrays

In this lesson, we shall learn a very important data structure that is very commonly used in programming. This data structure is called the array. When you want to store many information that uses...

Lesson 7: Functions

Remember that a C++ program always start from the main function? In this lesson, you will learn about what a function is. An add function In the earlier, you learned to write a program to...

Answers: Lesson 8

// Challenge 2 #include <iostream> int main () { int marks[10]; int total = 0, max = -1, min = 100; for (int i = 0; i < 10; i++) { std::cout << “Enter...

Lesson 6: Revision to while

Revise lesson 5 and attempt Challenge 2 and 3 once more. Intermediate while while is powerful because it allows a program to run until a certain condition is reach. Remember that you wrote a...

Lesson 5: while statement

In last lesson, we looked into using the if selection and for loop to make a program more dynamic. We also tried writing a program to print the first 10 Fibonacci numbers. Challenge 1 Can you...

Lesson 4: Strings, if and for statements

In last lesson, we covers std::string and basic logic using if. Let’s study the example below. #include <iostream> int main() { char gender = ”; // single quotes are for char, double quotes are...

Lesson 2: Variables

Variables are created in computer programs so that they can hold certain values. If we want to write a program to add two numbers, then we would need to have two variables to hold...

Lesson 1: Introduction

Read this post to understand what the objectives of this course is and also know what preparations are needed for this course. After you installed the IDE, you can proceed with this lesson. A...