Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/feed-rss2.php on line 8
‘Tec21’ Articles at TC101 Fall 2015 https://kenscourses.com/tc101fall2015 Introduction to Programming Python and C++ Thu, 22 Oct 2015 04:55:35 +0000 en hourly 1 https://creativecommons.org/licenses/by/4.0/ #Quiz08 https://kenscourses.com/tc101fall2015/2015/quiz08-21/ Thu, 22 Oct 2015 04:55:35 +0000 http://alansprogramming.wordpress.com/?p=85 Continue reading #Quiz08 ]]> Lists

Grab ink and paper, we’re making lists. “Grocery List” by Brittney Bush Bollay @ https://www.flickr.com/photos/tzofia/145057857/

  1. Write a function called sumsquares_list which receives a vector of int and returns the sum of the squares of the elementes in the list. For example, if we have a vector with the values x with values [1,2,3,4,5], sumsquares_list(x) would return 55 since 1 + 4 + 9 + 16 + 25 is 55.

GitHub link to code answer.

]]>
https://creativecommons.org/licenses/by/4.0/
#Quiz08 https://kenscourses.com/tc101fall2015/2015/quiz08-36/ Thu, 22 Oct 2015 04:55:35 +0000 https://alansprogramming.wordpress.com/?p=85 Continue reading #Quiz08 ]]> Lists

Grab ink and paper, we’re making lists. “Grocery List” by Brittney Bush Bollay @ https://www.flickr.com/photos/tzofia/145057857/

  1. Write a function called sumsquares_list which receives a vector of int and returns the sum of the squares of the elementes in the list. For example, if we have a vector with the values x with values [1,2,3,4,5], sumsquares_list(x) would return 55 since 1 + 4 + 9 + 16 + 25 is 55.

GitHub link to code answer.

]]>
https://creativecommons.org/licenses/by/4.0/
#Quiz07 https://kenscourses.com/tc101fall2015/2015/quiz07-12/ Mon, 19 Oct 2015 03:43:37 +0000 http://alansprogramming.wordpress.com/?p=82 Continue reading #Quiz07 ]]> Quiz07

Trippy, exactly what the quiz was like. Credit to Mark Strozler. Link @ https://www.flickr.com/photos/r80o/17657229/

  1. Write a function called fibonacci which receives a lon “n” and returns a long which is the value of the nth number in the fibonacci series which is: 0,1,1,2,3,5,8,13,21,34,55,89……….
    So, fibonacci(0) woud return 0, fibonacci(5) would return 5, fibonacci(8) would return 21.
    Note that the first two fibonacci numbers are 0 and 1.
    All others are the sum of the previous two fibonacci numbers.
    GitHub link to question 1 answer.
  2.  Write a function called isPalindrome which receives a string “x” and returns true if the string x is a palindrome, otherwise false.
    GitHub link to question 2 answer

]]>
https://creativecommons.org/licenses/by/4.0/
#Quiz07 https://kenscourses.com/tc101fall2015/2015/quiz07-28/ Mon, 19 Oct 2015 03:43:37 +0000 https://alansprogramming.wordpress.com/?p=82 Continue reading #Quiz07 ]]> Quiz07

Trippy, exactly what the quiz was like. Credit to Mark Strozler. Link @ https://www.flickr.com/photos/r80o/17657229/

  1. Write a function called fibonacci which receives a lon “n” and returns a long which is the value of the nth number in the fibonacci series which is: 0,1,1,2,3,5,8,13,21,34,55,89……….
    So, fibonacci(0) woud return 0, fibonacci(5) would return 5, fibonacci(8) would return 21.
    Note that the first two fibonacci numbers are 0 and 1.
    All others are the sum of the previous two fibonacci numbers.
    GitHub link to question 1 answer.
  2.  Write a function called isPalindrome which receives a string “x” and returns true if the string x is a palindrome, otherwise false.
    GitHub link to question 2 answer

]]>
https://creativecommons.org/licenses/by/4.0/
#Quiz06 https://kenscourses.com/tc101fall2015/2015/quiz06-15/ Sat, 10 Oct 2015 03:26:59 +0000 http://alansprogramming.wordpress.com/?p=78 Continue reading #Quiz06 ]]>
Quiz time!
1. Write a function called superpower that has two parameters of type long and returns a long which is first parameter raised to the power of the second, which is to say it returns ab
So, superpower(3,4) would return 81.
long superpower(long a, long b){
}
2. Write a function called stars that has one parameter of type int and PRINTS (the function does not return anything) that many stars on a single line followed by a end-of-line character, so if we call the function with stars(5), the function will print like this:
*****

]]>
https://creativecommons.org/licenses/by/4.0/
#Quiz06 https://kenscourses.com/tc101fall2015/2015/quiz06-30/ Sat, 10 Oct 2015 03:26:59 +0000 https://alansprogramming.wordpress.com/?p=78 Continue reading #Quiz06 ]]>
Quiz time!
1. Write a function called superpower that has two parameters of type long and returns a long which is first parameter raised to the power of the second, which is to say it returns ab
So, superpower(3,4) would return 81.
long superpower(long a, long b){
}
2. Write a function called stars that has one parameter of type int and PRINTS (the function does not return anything) that many stars on a single line followed by a end-of-line character, so if we call the function with stars(5), the function will print like this:
*****

]]>
https://creativecommons.org/licenses/by/4.0/
WSQ05 https://kenscourses.com/tc101fall2015/2015/wsq05-19/ Mon, 05 Oct 2015 23:51:52 +0000 http://alansprogramming.wordpress.com/?p=69 Continue reading WSQ05 ]]> What was the temperature again?

Temperature

Might be a little too cold for me down there…

We are going to see how well we’ve understood the “if” and “else” conditionals, you know, those pesky words from fifth grade Grammar:

WSQ4

First up we have the code. Notice that there is a void type function before the main function. This was used by me in order to see if I knew how to correctly use those, and it turned out well, but the code can do without a void type function, having the “if” and “else” conditionals inside the main funciton.

WSQ4 cyg

As usual, we compile in Cygwin to check for any mistakes and happily find out there are none, giving the program the value 289 as Fahrenheit temperature.

WSQ4 cygrun1

It does work! We get the conversion from Fahrenheit to Celsius and a message indicating that water reaches its boiling point at this temperature. Then we try with a lower value and get a message informing us that this is too low for water to become a gas.

Water

Water wonderful picture! “I <3 Water” by Derek Gavey. Link: https://www.flickr.com/photos/derekgavey/5599832932/

]]>
https://creativecommons.org/licenses/by/4.0/
WSQ04 https://kenscourses.com/tc101fall2015/2015/wsq04-18/ Mon, 05 Oct 2015 23:22:29 +0000 http://alansprogramming.wordpress.com/?p=64 ]]> Error 404: not found.

Just kidding, this is a redirect page for the fourth WSQ, the “About” page. Since I can’t put tags in the about page, you’ll just see everything from here. Hope it’s not too confusing!

WSQ04

]]>
https://creativecommons.org/licenses/by/4.0/
WSQ05 https://kenscourses.com/tc101fall2015/2015/wsq05-21/ Mon, 05 Oct 2015 23:51:52 +0000 https://alansprogramming.wordpress.com/?p=69 Continue reading WSQ05 ]]> What was the temperature again?

Temperature

Might be a little too cold for me down there…

We are going to see how well we’ve understood the “if” and “else” conditionals, you know, those pesky words from fifth grade Grammar:

WSQ4

First up we have the code. Notice that there is a void type function before the main function. This was used by me in order to see if I knew how to correctly use those, and it turned out well, but the code can do without a void type function, having the “if” and “else” conditionals inside the main funciton.

WSQ4 cyg

As usual, we compile in Cygwin to check for any mistakes and happily find out there are none, giving the program the value 289 as Fahrenheit temperature.

WSQ4 cygrun1

It does work! We get the conversion from Fahrenheit to Celsius and a message indicating that water reaches its boiling point at this temperature. Then we try with a lower value and get a message informing us that this is too low for water to become a gas.

Water

Water wonderful picture! “I <3 Water” by Derek Gavey. Link: https://www.flickr.com/photos/derekgavey/5599832932/

]]>
https://creativecommons.org/licenses/by/4.0/
WSQ03 https://kenscourses.com/tc101fall2015/2015/wsq03-23/ Mon, 05 Oct 2015 22:33:01 +0000 http://alansprogramming.wordpress.com/?p=57 Continue reading WSQ03 ]]> We’re now going to have lots of fun with numbers!

Numbers

“Magic numbers” by Emily Harrison. Link: https://www.flickr.com/photos/eeekkgirl/3614817763/

This is the preamble for functions, so it is a very important task to know what we’re doing here for future works. The code is shown here below, where we defining the variables before the main function, while making the calculations in the main function.

WSQ3

Then we compile it on Cygwin to check for any mistakes… since it doesn’t have any, we give the program the values 13 and 5, just for fun.

WSQ3 cyg

And run it to see how well it does its job!

WSQ3 cygrun

]]>
https://creativecommons.org/licenses/by/4.0/