--Originally published at Programming course
So in the WSQ06 we had to ask for a non negative number and display the factorial number. It was really easy because I used the same tutorial as in the WSQ05. Here is the code and this is the tutorial.
--Originally published at Programming course
So in the WSQ06 we had to ask for a non negative number and display the factorial number. It was really easy because I used the same tutorial as in the WSQ05. Here is the code and this is the tutorial.
--Originally published at Programming course
So i forgot to upload my blog posts but here are all the WSQ’s we’ve done so far
The fifth one we made it’s called “On to functions”, in which basically we have to ask the user for one number and give them integers, here is the code.
I used this link that helped me understand more the for loops.
--Originally published at Programming course
In this assignment we saw the number series of Fibonacci, which is basically a mathematical explanation to many things in nature, such as the spirals found in flowers, plants, etc, and the numerical sequence in them. In the program we made, using a loop I told the user the series. This is the code I used.
And if you want to know more about Fibonacci in art, you can click here and there is a great easy slideshow.
Pictures used:
https://www.flickr.com/photos/snlsn/
--Originally published at Programming course
In this part of the quiz we had to create a program where it had to print out a kind of triangle. The only thing I did was to use a “cout” per line, using the spaces needed. And that was it
--Originally published at Programming course
So the problem said that we should write this code:
#include main() { /* PROGRAM TO PRINT OUT SPACE RESERVED FOR VARIABLES */ char c; short s; int i; unsigned int ui; unsigned long int ul; float f; double d; long double ld; cout << endl << "The storage space for each variable type is:" << endl; cout << endl << "char: \t\t\t%d bits",sizeof(c)*8; // \t means tab cout << endl << "short: \t\t\t%d bits",sizeof(s)*8; cout << endl << "int: \t\t\t%d bits",sizeof(i)*8; cout << endl << "unsigned int: \t\t%d bits",sizeof(ui)*8; cout << endl << "unsigned long int: \t%d bits",sizeof(ul)*8; cout << endl << "float: \t\t\t%d bits",sizeof(f)*8; cout << endl << "double: \t\t%d bits",sizeof(d)*8; cout << endl << "long double: \t\t%d bits",sizeof(ld)*8; }
And then just run it. It was easy because it was just adding stuff like an “int” before the “main()”. The problem began with the couts , but all I had to do was to erase the “%” and the “d” in every line and that was it.
--Originally published at Programming course
In this program (the last one in the first partial ) I had to ask the user for two numbers a lower and an upper bound, so I could sum the numbers between them.
I didn’t know how to do it so this blog helped me a lot (THANK YOU!)
Here is my code
--Originally published at Programming course
In this program we had to make a random number and the user needed to guess it. If the number was to high or low, the program will tell.
First I made the random number called nu1.
Then I asked the user to guess and using if, I told the user if the number was higher or lower than the random one and made them choose again.
When they guessed the correct number I asked if they wanted to play again and that was it
--Originally published at Programming course
The assignment was about asking for a temperature in Fahrenheit and with a formula convert it to Celsius, then tell the user if the water will boil or not.
What I did was to ask for the number, then apply this formula: C = 5 ∗ (F − 32)/9. And finally using an if, tell the user if the water boils or not (Temperature in Celsius>=100 it boils)
--Originally published at Programming course
So the assignment was to ask the player/user (¿?) for two numbers, and our job was to create a program that could sum, substract,multiply, divide and give the remain of the division.
And the formulas I used were:
And basically that’s it
--Originally published at Programming course
So during class I started my code and I thought I was done but the time was over, so as soon as I got home I started compiling my program, but the trouble started. I had many error and the program couldn’t run, so i went line by line trying to figure out what was wrong. At the end I only had one error about a “{” symbol, but if I moved it or delete it, I would have 19 errors, at the end I noticed I had a “;” before that “{” and I could finish.