You are currently browsing the STARS at MEDAL blog archives for June, 2012

Code from learning session 3

Here’s the code related to what we did in this session:

I forgot to get to the greatest common divisor, which I still wanted to do, but we can deal with that in the next class.

Assignment 2

This assignment is due by the next learning session on Friday, June 15, 2012. Please complete the programs on, and send me the links to your programs via email at

Program A3:
Implement a program that counts the number of all natural numbers up to 10000 (including 10000) that are divisible by at least one of the following three numbers: 5, 8, and 12. For example, numbers 25, 75 and 130 are counted, because they are divisible by 5. Similarly, 16, 32 and 40 are counted because they are divisible by 8. In the end, the program should print out the number of all such natural numbers.

Program A4:
Modify the program A3 to print out also the sum of all the numbers that were counted in the previous problem A3. Therefore, the two outputs should be: (1) the number of all natural numbers up to 10000 divisible by any of 5, 8 and 12, and (2) their sum.

Code from learning session 2

The code I’ve done real-time during the session can be found on the following link:

In addition, these are the pieces of code I prepared prior to the session:

I will add more code relevant to the use of functions after the next session.

Assignment 1

This assignment is due by the next learning session on Wednesday, June 13, 2012. Please complete the programs on, and send me the links to your programs via email at

If you are having problems or questions, please email me so that we can address these before it’s too late.

Program A1:
Implement a simple program that prints out your first name, one letter at a time. That is, you will write a separate “cout” statement to print out every single letter of your name. The output should include the entire name though (you should not put end of lines after each character, the name should look intact).

Program A2:
Implement a program that reads 3 integers from the user (let’s call them i, j, and k). You may assume that the numbers are unique (each number is different from the other two numbers), and that they are all positive. Your program should then check whether any of these numbers is divisible by any other of these numbers, and report all such situations (by printing out each pair of numbers for which this holds). If none of the numbers is divisible by one of the other numbers, there are going to be no outputs.


  1. input:
    5 10 15

    10 is divisible by 5
    15 is divisible by 5
  2. input:
    7 3 21

    21 is divisible by 7
    21 is divisible by 3
  3. input:
    13 17 3

  4. input:
    80 16 8

    80 is divisible by 16
    80 is divisible by 8
    16 is divisible by 8

Code from learning session 1

Here’re the links to the programs we worked on during the learning session 1:

Additional links to similar codes that I prepared earlier (I already posted about these):

Added calendar of events

To keep track of our meetings, I created a Google Calendar for the events that involve me (for other STARS events, see the official STARS-2012 schedule). I’ve put the calendar also on this blog. The calendar can be accessed by following the link calendar of events on the right-hand side of this blog (under Pages).

Variables, arithmetic operations and conditions

The following set of programs provides examples for use of variables, arithmetic operations, and conditions. We will look at more examples when we meet:

Program 2: Arithmetic operations, variables

Programs 3-6: Conditions

Additional materials for these topics can be found in the books I suggested or online. As we go through more complex topics, we will of course have to revisit these basics and get better at them.

Program 1: I’m alive!

I’ve already put in a few programs for us to start with, here’s the first one. Don’t worry about the post until we start with the program on June 11, 2012 (but of course feel free to look at it already if you want):

When you click on the link, you should be able to see the first, simple program, similar to the classical “Hello World!” program. The only thing the program does is print out a line with “I’m alive!” on the screen. The output is shown in the page as well, and you can edit and play with the program there yourself.

First step: Create an account on

We will complete all or most of the programming projects as well as simple demo programs using an online tool that allows one to execute, store, and share programs. This should make the communication between us much more efficient.

Please, go to the following site and register an account on it, so that you can use the site for your own code. As the primary language, we will use C++ (so you can choose C++ as the default language to work with):

We will use to work with programs used by me to teach you main concepts, as well as by you to solve home assignments. The site makes it quite easy to edit the code, run it, and share it. Code can also be assigned to one or more categories, and cloned to create more complex projects in future starting from a previous project.

Welcome to STARS at MEDAL

STARS at MEDAL blog is dedicated to the STARS project at the Missouri Estimation of Distribution Algorithms Laboratory (MEDAL) at the University of Missouri. We will use this blog to post important links throughout the project and keep track of what has been covered, and is required for successful completion of this program.