--Originally published at TC1017 Programing Curse
it is going to be, from july 5 to july 9, it is going to be amazing, i wanted to see stan lee crying in silence
http://mexico.campus-party.org/
--Originally published at TC1017 Programing Curse
it is going to be, from july 5 to july 9, it is going to be amazing, i wanted to see stan lee crying in silence
http://mexico.campus-party.org/
--Originally published at TC1017 Programing Curse
i found that interesting new, you have to read it
http://www.geek.com/tech/germany-broke-a-renewable-energy-record-in-april-1698981/
--Originally published at TC1017 Programing Curse
im linking this post to rodrigo’s one, because he post about the competition
https://rodrigozermenoblogs.wordpress.com/2017/05/11/first-fobotics/
--Originally published at TC1017 Programing Curse
i had to download scilab
image taken from https://www.daysoftheyear.com/days/curious-events-day/
i have been playing with the tool, and i know how to, vizualize data in it, and change it
--Originally published at TC1017 Programing Curse
In this assignment i had to estimate the mathematical constant e. I create a function called calculuate_e which receives one parameter called precision that should specify the number of decimal points of accuracy.
There is the code
#include <iostream>
#include <math.h>
using namespace std;
int getFactorial(int num){
if (num == 1 || num == 0)
{
return 1;
}
else
{
return num*getFactorial(num-1);
}
}
float euler_calc(float par){
float num = 0.0, result=0.0;
do{
result += 1.0/(getFactorial(num));
num = num + 1;
} while(num <= par);
return result;
}
int main(){
float par, result, num=0.0;
cout << “Give me the parameter ” << endl;
cin >> par;
cout << “The answer is ” << euler_calc(par) << endl;
return 0;
}
image taken from http://digg.com/video/eulers-constant-explained
--Originally published at TC1017 Programing Curse
Is fibonacci with the recursion method, i had some help from the book
#include <iostream>
using namespace std;
int fibonacci (int n) {
if (n == 0 || n == 1) {
return 1;
} else {
return fibonacci (n-1) + fibonacci (n-2);
}
}
int main ()
{
int i, n;
cout << “give me a number ” << endl;
cin >> n;
for (i=0; i<n; i++){
cout << fibonacci (i) << endl;
}
return 0;
}
image taken from: http://www.zurditorium.com/la-sucesion-de-fibonacci-y-los-numeros-primos
--Originally published at TC1017 Programing Curse
This homework ask me to create a program that prints something that is in a .txt, it was a little difficult to understand how to do it but at the end after investigate it was actually easy
and also here we can see Mastery Topic 19, and 21
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
string game, name;
cout<<“Tell me which game do you want to know its history “<<endl;
cout<< “(FallOut, Borderlands, Doom)”<<endl;
cin>>name;
if (name==”FallOut”){
ifstream file(“FallOut.txt”);
if(file.is_open())
{
while(getline(file,game))
cout<<game<<endl;
}
file.close();
}
else
{
cout<<“Try Later “<<endl;
}
}
else{
if(name==”Borderlands”){
ifstream file(“Borderlands.txt”);
if(file.is_open())
{
while(getline(file,game))
{
cout<<game<<endl;
}
file.close();
}
else
{
cout<<“Try Later”<<endl;
}
}
else{
if(name==”Doom”){
ifstream file(“Doom.txt”);
if(file.is_open())
{
while(getline(file,game))
{
cout<<game<<endl;
}
file.close();
}
else
{
cout<<“Try Later”<<endl;
}
}
}
}
return 0;
}
i just have to convert this into a fucntion.
image taken from: http://kotaku.com/lets-rank-the-fallout-games-best-to-worst-611408965
--Originally published at TC1017 Programing Curse
This program do a piramid with T, ask the user the range and print the piramid, this program use nested fors.
#include <iostream>
using namespace std;
void triangles(int a)
{
for(int i = 1; i <= a; i++)
{
cout << endl;
for(int k = i; k > 0; k–)
{
cout << “T”;
}
}
cout << endl;
for(int i = a-1; i > 0; i–)
{
for(int k = 0; k < i; k++)
{
cout << “T”;
}
cout << endl;
}}
int main()
{
int triangle;
cout << “Dame la cantidad de triángulos que quieres que aparezcan ” << endl;
cin >> triangle;
triangles(triangle);
return 0;
}
image taken from: http://respuestas.tips/cuales-son-los-tipos-de-piramides-geometricas/
--Originally published at TC1017 Programing Curse
This Mastery topic is about the use of while
and do while
the diference between dowhile and while, is that do while even though it does not match the condition i will do it at leats once, and if you use just while if it does not match the condition it wont do anything
--Originally published at TC1017 Programing Curse
This time i have to create a program that asks the user for 10 numbers, and store those numbers in a list. Show to the user the total, average and standard deviation of those numbers.
Also we can see mastery topic 18 here, the use of list, http://www.cplusplus.com/doc/tutorial/arrays/ this page helped me.
image taken from http://blog.martincruz.me/2012/11/unir-dos-listas-simples-circulares-en-c.html
#include <iostream>
#include <math.h>
using std::cout;
using std::cin;
using std::endl;
float getTotal(float numbers[], int numNumbers){
float answer=0.0;
for(int i = 0; i < numNumbers; i++){
answer = answer + numbers[i];
}
return answer;
}
float getAverage(float numbers[], int numNumbers){
float answer=0.0;
answer = getTotal(numbers,numNumbers);
answer = answer / numNumbers;
return answer;
}
float getStdDev(float numbers[], int numNumbers){
float varianza=0.0, answer=0.0, prom=0.0, dev=0.0;
prom = getAverage(numbers,numNumbers);
for(int i = 0; i < numNumbers; i++){
varianza = varianza + pow((numbers[i]-prom),2);
}
dev = sqrt(varianza/numNumbers);
return dev;
}
int main(){
const int NUM_NUMBERS=10;
float x[NUM_NUMBERS];
for (int i = 0; i < NUM_NUMBERS; i++){
cout << “Dame un número “;
cin >> x[i];
}
float total = getTotal(x,10);
float average = getAverage(x,10);
float stdev = getStdDev(x,10);
cout << “El total es: ” << total << endl;
cout << “El promedio es: ” << average << endl;
cout << “La desviación estándar es: ” << stdev << endl;
}