Skip to content

Instantly share code, notes, and snippets.

View jesuscmadrigal's full-sized avatar

jesuscmadrigal

View GitHub Profile
#include <iostream>
int main() {
std::cout << "hello world";
return 0;
}
#include <iostream>
int main()
{int x,y,suma,resta,product,division,residuo;
std::cout<<"\n ingrese numero x:";
std::cin>>x;
#include <iostream>
using namespace std;
int main()
{ int Celsius,Fahrenheit;
cout << "Enter Fahrenheit temperature: ";
cin >> Fahrenheit;
Celsius = (Fahrenheit-32)*5/9;
cout << "Celsius = " << Celsius << endl;
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main ()
{
int Random, Num ,Guess;
Guess = 0;
srand(time(0)) ;
#include <iostream>
using namespace std;
int main ()
{ int sum,min,max,n;
sum=0;
cout << "We´re going to sum up numbers between numbers!!" << endl;
cout << "Now pick the first integer that you want to initialized: " << endl;
cin >> min;
n=min;
@jesuscmadrigal
jesuscmadrigal / On to functions
Created September 14, 2017 23:52
On to functions
#include <iostream>
#include <cstdlib>
using namespace std;
int sum (int x,int y)
{
int sum;
sum=x+y;
return sum;
}
@jesuscmadrigal
jesuscmadrigal / Factorial
Created September 15, 2017 00:14
Factorial
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main ()
{
int X, Y;
double long A;
string another;
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
// input is a non-negative value
// output is the factorial of n.
// remember that 0! is 1
// fix the wrong answer of always 42
unsigned long long factorial(unsigned long long n){
if (n==0) {
#include <iostream>
#include <cmath>
using std::cout;
using std::cin;
using std::endl;
float total(float array[],int size){
float sum = 0.0;
for (int i=0;i<size;i++){
sum=sum+array[i];
}
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
// returns the minimum value (smallest) of a b c d
float minimum_of_4(float a, float b, float c, float d){
if(a<b && a<c && a<d) {return a;}
if(b<a && b<c && b<d) {return b;}
if(c<b && c<a && c<d) {return c;}