WSQ09 – Factorial Calculator

Hey guys, here is an other #wsq.
This time its about factorial numbers

HERE IS THE CODE   factorial

Well, we start as always with #include and using namespace

then we create two variables, one wich is going to be the number the user enters and the other is going to be the factorial

The factorial is created by a for()  }

for(int a=1; a<=num ;a++)
{

factorial= factorial*a;

}
Here is one page provided by Canadamike, he helps me with this wsq, this is usefull
http://fahad-cprogramming.blogspot.mx/2013/02/program-to-find-factorial-in-C-Programming.html

·Word Count· #WSQ12

Hello people! Here is my WSQ12 in which I was told to create a program that could find a certain word (given by the user) in a text file (also given by the user). 

So let’s start with the function. I created a function called find_word and its job was like the name, to find the word in the text file. There are two string variables: the word that the user is looking for and ‘sample’, that is the text file given by the user. The ‘ifstream myfile allows you to look for the text file on your computer. Then I put an if statement that says ‘if the file is open do this…’. As you want to find a word as many times as it appears in the text file, you must analyze each line of the text file, here is where the getline  helps you. This function goes by every line and then with the comparison, you can find the word and the counter increases.

Then you have to close the file with myfile.close() 

Captura de pantalla 2016-03-29 a las 12.09.11 p.m.

And here is the rest of the program, where I ask for the word and the name of the text file. Then I just called my function and that’s it. The result was in the function find_word.

Captura de pantalla 2016-03-29 a las 12.10.37 p.m.

You can look at my code here in GitHub. Feel free to comment.

Thank you Ken for the help with this program!! 

24294566811_7004231734_k
Another Sunrise over the Alps by Rogg4n Link on Flickr: https://www.flickr.com/photos/128294308@N05/24294566811/in/explore-2016-01-14/

·YoSoy196· #WSQ11

So the time has come….and to be honest, I have no idea of how this works. This story starts when Ken told us that this would be the most difficult program that we might create on this course. I was motivated at first in trying to create it but all the happiness and motivation just was gone. My friend Dario was working in this program for a week and it finally worked. He promised me that he would explain it to me how it works, but the day never came. Now I have to admit that I just copied his program, but I will try to do it by myself later, and hopefully it will work.

Here is the code (obviously from Dario’s mind) on GitHub. 

HAHAHAHA DARIO WAS LIKE THIS WHEN HE THOUGHT THE PROGRAM HAD FINALLY WORKED AND HE WAS WAITING THAT IT COMPILED. DON’T FORGET TO VISIT HIS BLOG RIGHT HERE: https://dariomagana10.wordpress.com

1qe1nhe0fi0vy

Alex H.

·Lists· #WSQ10

Bueno este blog lo escribiré en español debido a que tengo demasiada flojera para inspirarme en inglés…

En este programa tenía que crear una lista de 10 números y al final mostrar la suma de éstos, su desviación estándar y el promedio de los números. Para este programa es muy recomendable el uso de funciones.

Creé una función llamada getTotal que era la encargada de sumar todos los números. Después creé otra función llamada getAverage que era la encargada de obtener el promedio de los números, pero dentro de ésta llamé a la función getTotal, en la que ya tenía el total de la suma y solo tenía que dividirlo entre los 10 números.

Por último, para la desviación estándar tuve que buscar la fórmula y ésta usaba mi función de promedio. Tuve que pedir un poco de ayuda de mi buen amigo Darío, puedes visitar su blog aquí.

Captura de pantalla 2016-03-08 a las 12.08.01.png

También puedes encontrar el código de este programa en GitHub. Click aquí.

5nczoumgibjzo

#WSQ10 LISTS

Well for this WSQ we had to create a list of numbers where the user inputs 10 numbers, and from there you must add them all, get the average, and get the standard deviation. But fiest Mr. Bauer ask us why we uses “namespace std” if we didn’t know what that meant, therefore he showed us that we should use what we know, in this case “include std::cout,cin, endl” so that’s what we did. And he also gave us the first Function we needed for the program.Screenshot13.1

from the first function we had to imagine how the 2nd and 3rd would look like, I wondererd for so long until I went onto my m8 Dario’s blog, and checked if he had done another function for the average, which was the case, but contrary of what I had thought, he used last function in the new function so he didn’t have to add the numbers again. And for the standard deviation we had to do one Function totally different.

Screenshot13.2.png

Finally the main was easier that all, you just had to put all the variables on the float, add a constant for the Numbers and say that the number to be inputed would be until it became equal to 10 (i=10) so each time a number would be inputed, the counter would go (i++).

The you just have to print the answers, using the functions with the variables (x, numberofNumbers) and end, between each line.Screenshot13.3

Here is my code in case you might need it.

 

#WSQ04 Flipped Learning

WHAT DO WE THINK ABOUT FLIPPED LEARNING, and Ken’s way to evaluate?

 

Well to begin I would like to say that Lecturing in front of a class can be boring for both the students and the teacher, and the outcome is sleeping students and no learning at all, the way teacher try to teach us is unreliable at this time, because most students would rather work on their own instead of hearing to the teacher for 1:15 hours, that is the main problem with having a lecturing class, instead what the flipped learning is asking for the students to help themselves to learn, by working in teams or asking everyone in order classrooms whether they know or not, students may also ask for help of the teacher, but always remembering that the main teachers are ourselves.

high

Another thing to talk about is the way Ken evaluates his students, to me this is the perfect way, because we show ourselves what we are capable of, and in case we couldn’t do it, it is ok because we have our fellow classmates and friends who might help us easily. By abolishing grades, we don’t have the pressure to know that we need to study everything a night before to “pass” the parcial. WE JUST SHOW WHAT WE CAN DO, AND WHAT WE KNOW!!!

bat

If you want to make your own Memes, come here

 

#WSQ09 Factorial Calculator

In case you might need it, here is the code

And I used this web page to help me out: http://fahad-cprogramming.blogspot.mx/2013/02/program-to-find-factorial-in-C-Programming.html

 

Well now to begin with this awsome factorial calculator we shall start as we had before

#include<iostream>

using namespace std;

Then we show that the numbers we will be using are “int” for num, factorial, else we could use “float” but “int” is the one we choose for this program.

So we ask for the number we will be getting the factorial

Screenshot8.1

Then we proceed to show what “a” would be in order to make this factorial calculator work a=1;a<=num;a++ sayin that a would be 1 until it’s lower or equal to the number you introduce at the beginning, and saying that a would increase 1 each time until it’s equal to your first number

In order to get the factorial the formula we would be using is ” factorial=factorial*a;  ” showing that the factorial will multiply “a” in order to get the right factorial number.

Screenshot8.2.png

Finally you will be giving out the result of the factorial of the number the user wrote in, and never forget ” return 0; ” otherwise your program might not work.

 

 

#WSQ08 Functions Beach

Hey so for this new assigment we had to do Fun With Numbers again, but this time we needed to create a function before we asked the user for the numbers; therefore the structureyou must follow is:

int add (int a, int b)
{
    int s;
    s=a+b;
    return s;
}

That’s the main structure for each function, you must do this for the substraction, division, and integer division, remember to change the letter or name for each function though.

Screenshot7.1.png

Then you can proceed to begin with the main program, where you’d be asking for the numbers who will be used  :

int main ()
{
int a, b, s, r, m, d, i;
cout<< “Give me a integer number” << endl;
cin>>a;
cout<< “Give me second integer number” << endl;
cin>>b;

Screenshot7.2.png

There you can see that we choose our functions created before, and showing that the integers which are going to be use are the ones choosen before; finally we print the answers using “cout” finally ending with the return 0; “

Heres is my code, in case you need it

 

 

·Factorial calculator· #WSQ09

 

 

This one was a bit interesting and funny. I wrote something similar in my C# course last semester, so I had the idea of the logic of the program. After trying for a while, it finally worked and it was amazing…but I still was having a problem… the main loop didn’t work :/ so the question of “Would you like to type another number?” was useless.

At first I thought I confused the order of the loops but that wasn’t the problem. My friend Christian saw my code and we were trying to figure it out what was the problem… and finally we discovered it……. I used the variable “answ” as int and not as char… hahaha here is some advice for everyone: Make sure you have declared right you variables so you won’t be having any problem as I had!

Captura de pantalla 2016-02-03 a las 12.29.07.png

Here is a screenshot of code, also you can find it on GitHub if you want to download it and trying to make some changes, feel free. Link.

Captura de pantalla 2016-02-03 a las 12.31.53

I recorded a video of my code working with Jing, that is an awesome app which allows you to record whatever you are doing on your computer… Here is the link of my code working via ScreenCast.

Captura de pantalla 2016-02-03 a las 12.49.47

Alex H.

 

24294566811_7004231734_k
Another Sunrise over the Alps by Rogg4n Link on Flickr: https://www.flickr.com/photos/128294308@N05/24294566811/in/explore-2016-01-14/

·Sum of numbers· #WSQ07

For this program I had to use an if and a loop. The use of “if” was in order to make sure the user would not screw it up with the order of the numbers. At first I couldn’t figure it out the main logic of the program but then I had a moment of inspiration haha and here is the result.

Here is a screenshot of my code. Also you can check it out on GitHub. Link.

Captura de pantalla 2016-02-02 a las 12.38.34

It is important to keep in mind that the user won’t do exactly what you want, so you should always be prepared for the unexpected things.

And here you can see a video of my code working on ScreenCast…. Link

Captura de pantalla 2016-02-02 a las 22.57.19.png

I will be publishing all the WSQ’s soon and I hope it would help others. 😀

Alex H.

24294566811_7004231734_k
Another Sunrise over the Alps by Rogg4n Link on Flickr: https://www.flickr.com/photos/128294308@N05/24294566811/in/explore-2016-01-14/