Quiz 7

This function called dot_product receives two lists of numbers (say list1 and
list2). The function returns what is the dot product of the two lists.

For full marks, if the lists are not the same size, then the function should return the
special value of NaN (which represents not a number).

Example. If the input is [2,4,5,6] and [1,2,3,4] the result will be 49 since (2*1)+(4*2)+(5*3)+(6*4) = 49

quiz7-1quiz7-2

Quiz 6

This program should receive two integers and return an integer.Obviously you should test your function, so create a main program that asks the user for two values, calculates the gcd and displays that.

quiz6

Quiz 5

This function called is_palindrome which receives a string as a parameter and returns true if that string is a palindrome, false otherwise. Remember that a palindrome is a word that is the same forward or backward. For full points your function must ignore case and must work with any character (not just letters). So (“Dad$dad” is a palindrome even though the D is capital and d is lower case).

quiz5-1

This function called find_threes that receives as a parameter a list (or Vector or array for C++ students) of numbers and returns the sum of all numbers in that list that are evenly divisible by 3. Note if using vectors, you will need an additional parameter to represent the number of numbers in the array. So if the list was [0,4,2,6,9,8,3,12], the function would return 30 (0+6+9+3+12).

quiz5-2

EXAM 2

In this WSQ we correct the second parcial.

First part:

In this program you have to form a triangle with “T”

WSQ13-1+

Second part:

In this part you have to make a function to recive two numbers and solve a pow formula.

WSQ13-2

Third part:

In this part you have to make a program whit fibonacci formula and ask to the user for the number of terms.

WSQ13-3

Word Count

This program asks the user for a word which will be your search word and the name of a file to open and search for that word. Then create a function that will receive two parameters (both string) representing those two data points. This function returns the number of occurrences of that word in that file.

WSQ12WSQ12-2

 

Yo soy 196

This program asks the user for two pieces of data:

  • The lower bound of the sequence
  • The upper bound of the sequence
Then you check the values from the lower bound (inclusive) to the upper bound (inclusive) and make a report of them. During the analysis of each number, if a Lychrel number is found it should be reported immediately with something like “Found a Lychrel number: 196”

WSQ11

WSQ11-2

Proyect, Pac-Man!!

In this proyect we will make one of the moro famous old-game, Pac-Man, for this proyect we visit mote blogs to take code and information and we find a code for this game but was incomplete and we had to complete and now the code run but we don´t have a compiler for grafics and games but the code is ready.

Proyecto1Proyecto2Proyecto3

This rare code is the map we find in other blog and how to do it and we modify a little.

Proyecto4Proyecto5

The function “Borrar Pac-man” is for star with a new life if you fail.Proyecto6Proyecto7Proyecto8

All code is for the phamtoms.

Proyecto9Proyecto10Proyecto11

Proyecto12

Quiz 2

This program use a function called superpower that has receives two parameters (ints) and returns an integer which is first parameter raised to the power of the second, which is to say it returns a b . There are many ways to do this, but the intent is for you to use a loop or recursion.

quiz2-1

This program use a function called stars that has one parameter of type integer and PRINTS that many stars on a single line, so if we call the function with stars(5), the function will print like this: *****

quiz2-2

 

Quiz 3

This program use a function to called distance(x1, y1, x2, y2) which receives four numbers which represent two points in the cartesian plane. The function should return the distance between the two points (x1,y1) and (x2,y2). Remember that the square of the hypoten.

quiz3-1

This program use a function to called fibonacci which receives a single parameter “n” (a non-negative integer) and returns the nth number in the fibonacci series which is: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89………… So, fibonacci(0) would return 0. fibonacci(5) would return 5 fibonacci(8) would return 21.

fib