You are currently browsing the STARS at MEDAL blog archives


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

Code from learning session 4

Code from today’s learning session can be found here:

http://ideone.com/pelikan/session_4

Technical Writing for Fun and Profit

David E. Goldberg was my Ph.D. advisor, and was excellent at writing. He wrote a short article Technical Writing for Fun and Profit on technical writing, please read this, it should be helpful in writing a good report. The article can be found at

http://ise.illinois.edu/ge494/technl-writing-fun.pdf

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.

Code from learning session 3

Here’s the code related to what we did in this session:
http://ideone.com/oOW95
http://ideone.com/23FeL
http://ideone.com/KEveU
http://ideone.com/92Fzk
http://ideone.com/syk40
http://ideone.com/BpZqr
http://ideone.com/1Mfeh
http://ideone.com/ubVxy
http://ideone.com/oi04l

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

Code from learning session 2

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

http://ideone.com/pelikan/session_2

In addition, these are the pieces of code I prepared prior to the session:
http://ideone.com/Eoilq
http://ideone.com/orQlP
http://ideone.com/WStdy
http://ideone.com/IC1hX
http://ideone.com/kIUQr

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

Code from learning session 1

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

http://ideone.com/MbXAy

http://ideone.com/vjSga
http://ideone.com/QQU6O
http://ideone.com/doC0s
http://ideone.com/5Ea86
http://ideone.com/MbXAy

Additional links to similar codes that I prepared earlier (I already posted about these):
http://ideone.com/5Z7o5
http://ideone.com/CL2TD
http://ideone.com/6GvFA
http://ideone.com/AvtTw
http://ideone.com/JoRau

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