This quiz was about making a function that receive two lists of numbers and returns the dot product of the two lists.
What does it means? For example if your input is: [1,2,3,4] and [5,6,7,8], the answer will be 70. Why? Because (1*5)+(2*6)+(3*7)+(4*8) = 70
It wasn´t necessary to add the Not-a-number value because since the begging it ask to the user how many numbers does he wants on his lists.
You can see the code here: Dot Product.
Also I attach some pictures of the program working.
This quiz was about functions, they were many possible answers but it was expected that we use a loop or a recursion:
The first one was: Create a program with the following function. Write 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 .
The second one: Create a program with the following function. Write 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: *****
Well I had to confess that this was a quiz that we had weeks ago, but at that time I didn´t know how to do it cz I didn´t know how to make a function and was not really sure how to do a Do-While.
Now after investigating for making my WSQ’s and learning about how to make functions and Do-While, I was ready for this.
For making the first one I decided to use a Do-While. The first number would be multipling by itself until the “contador” (who was adding one each time the program repeated) was the same value than the second number, who was the “raised to the ___ “.
During making this program the first time I run it I noticed that I didn’t ask the user for the two values … JA-JA. (Not funny at all … ), the second time I run it… it did not work cz it was printing again the first value… and the third one (yes…you know what they say
Continue reading “Quiz 2”
All this thing about learning by myself and no-grading its actually new for me and for many of us. At first this could sound really difficult because it is something we are not used to, but when the time passes you get to notice all the things that u have learn and mostly by yourself or asking to your classmates.
This way of learning can teach you not only the topics you are suposed to learn, also it teach you to be responsible, organize and helps you to learn to ask, something which I considere really difficult.
Today I can say that abolish grading its weird, yes, but even it is, I like it necause I can see all those things I learn and Im proud of it.
This WSQ was about using the WSQ3 made before but changing it, now using functions for making each calculation.
As I didn´t know how to make functions on c++ I search for it and foun this page that helped my doing this program. (Here).
For each of the operations I needed to use:
int TheOperation (int x, int y)
a = x (-/*%) y;
return a; }
And just at the end instead of using:
cout <<“The difference of these two numbers is: “<<resta; I just added the two numbers. Ex: cout <<“The difference of these two numbers is: “<<resta (number1,number2);
This was made for all the operations.
You can see my program here: funtions. Feel free for using it.
This are some pictures of my program:
Haga click para ver el pase de diapositivas.
This program is about asking a range of integers and then it gives you the sum of the numbers in that range.
For example, the sum from 3 to 6 would be 3 + 4 + 5 + 6 = 18.
Even it was not hard at all, I was having trouble because I had little mistakes that I didn´t noticed at first.
Then the program was working, but the sum of the numbers was wrong so I changed again and finally it work correctly.
This program was about using a simple do – while so it can keep making sum until de first number its equal to the second one.
Here you can see my code: Sum of numbers.
And this is a picture of my program working. Notice that at first you can see the wrong sum of the numbers that I changed at the end.
This WSQ was about making a program that picks a random number between 1 and 100 and then give you clues for you to know if you are near of the random number or not. Also the user is able to know how many guesses did he had to make to get the correct answer.
Even I had an idea of how to do this program, I needed to search how to generate a random number. Here are some links that I used for making this task: Tool 1, Tool 2, Tool 3. Also a video, it was not the same thing but it was really similar.
After searching I noticed that I had to use some other libraries: stdlib.h and time.h . The first one was needed so I could be able to use ” rand() ” for generating the random number, and the second one was a library to know the actual hour of the system, this because if not it would always generate the same number. So if we use that library it would not be possible to generate a same number twice because its not possible to use the program twice or more in a second.
I need to make this program twice because for any reason the first one that I made was not working (Yes, I compared them and they said the same but one was working and the other one not 🙁 ).
I had already use Do – While before on C# also If – else. So the main problem on this task was generating a random number and the fact that I was using new libraries.
You can see my program on github: Random number.
I attach a picture of my program working (You can notice that
Continue reading “Guess the number”
This was a really easy to make program. For this WSQ I had to make a program that would allow the user to change a temperature in Fahrenheit to Celsius. And after that the program would say if water would boil or not at the temperature given.
For changing Fahrenheit to Celsius I just needed to write a program like the others but with the formula to change Fahrenheit to Celsious.
For saying if the water would boil or not I decided to used an if/else. If the temperature in C° was more than 100(temperature in which waters boils) it would say that in normal conditions, water would boil but if the result was a number smaller that 100 then it would say that water would not boil.
You can see my program right here: Temperature.
And this is the prove that it is working 😛 .
I made this meme after finishing the program JAJAJAJ.
This WSQ was about asking the user for two integer numbers and then showing the difference, the product, the division and the remainder of integer division of those two numbers.
I didn´t have a lot of problems with this one. The structure was similar to other one I had made before but with more instructions on what the programs has to make. What I didn´t know was who to print the results of the instructions. So I look for it and found a blog that had a similar program, there I noticed that for printing you use also ” << ” after adding that my program worked correctly. If you want to see the blog click here.
You can see my program here: Playing with numbers.
The first thing that I had to do was to install a code editor and to set up my computer to run the GNU C++ compiler (g++). There were many options for the code editor like Atom, Notepad++ and Vim but I didnt now which one to download so I asked a friend who already took the class and he recommended me Atom.
Downloading Atom was pretty easy, I just needed to press the download boton.
*You can download it from here: https://atom.io/
Then I needed to install Cygwin because I have windows on my computer. There I had no option so I had no problems choosing (lol).
*You can find it here: https://www.cygwin.com/
… But it was kinda difficult because there u didn’t have to download everything just what we need for this course, so I had to ask a classmate how to do it.
After installing both, u are ready for starting to programming.
Haga click para ver el pase de diapositivas.