You are currently browsing the archives for the important category


Assignment 5

This assignment is due by the next learning session on Monday, June 25, 2012. Please complete the programs on ideone.com, and send me the links to your programs via email at martin@martinpelikan.net.

Program A10:
Solve problem 7 from projecteuler.net. Submit the solution directly on the projeuler.net site so that you get it verified, and send me the link to the program you used to compute the solution (just like for previous problems).

Program A11:
Solve problem 9 from projecteuler.net. Submit the solution directly on the projeuler.net site so that you get it verified, and send me the link to the program you used to compute the solution (just like for previous problems).

Assignment 4

This assignment is due by the next learning session on Wednesday, June 20, 2012. Please complete the programs on ideone.com, and send me the links to your programs via email at martin@martinpelikan.net.

Program A8:
Solve problem 5 from projecteuler.net. Submit the solution directly on the projeuler.net site so that you get it verified, and send me the link to the program you used to compute the solution (just like for previous problems).

Program A9:
Solve problem 6 from projecteuler.net. Submit the solution directly on the projeuler.net site so that you get it verified, and send me the link to the program you used to compute the solution (just like for previous problems).

Assignment 3

This assignment is due by the next learning session on Monday, June 18, 2012. Please complete the programs on ideone.com, and send me the links to your programs via email at martin@martinpelikan.net.

Program A5:
Solve problem 1 on projecteuler.net. You can verify the solution directly on projecteuler.net (once you create a login). There is no penalty for a wrong answer, so once you are done with the programming go ahead and try to submit the answer. If the answer does not match, try to correct your code and submit again. On a side, this problem can be solved using a paper and pencil, but I want you to actually implement it in C++, so that your program gives you the answer.

Program A6:
Find the largest number in the Fibonacci sequence that is smaller than 100,000 (one hundred thousand). That means, print out the number in the Fibonacci sequence that is smaller than 100,000 and at the same time the next number in the sequence is definitely at least equal to 100,000. Print the number out. (Hint: You should keep generating new terms in Fibonacci sequence until you hit 100,000 (or more), and then output the previous number before hitting 100,000).

Program A7:
Solve problem 2 on projecteuler.net. You can verify the solution directly on projecteuler.net (once you create a login). There is no penalty for a wrong answer, so once you are done with the programming go ahead and try to submit the answer. If the answer does not match, try to correct your code and submit again. Once you have solved A6, this should be a piece of cake.

Let me know if you have any questions as soon as you have them.

Assignment 2

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

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.

Assignment 1

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

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.

Examples:

  1. input:
    5 10 15

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

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

    output:
  4. input:
    80 16 8

    output:
    80 is divisible by 16
    80 is divisible by 8
    16 is divisible by 8

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).

First step: Create an account on ideone.com

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):

http://ideone.com/

We will use ideone.com 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.