Skip to content

Instantly share code, notes, and snippets.

@Adals20
Adals20 / helloworld.cpp
Created January 17, 2017 00:34
Hello World en C++
#include <iostream>
using namespace std;
int main (){
cout << "Hello World" << endl;
return 0;
}
@Adals20
Adals20 / numeros.cpp
Created January 17, 2017 00:37
Operaciones básicas con 2 números C++
#include <iostream>
using namespace std;
int main (){
cout << "Escriba el primer numero" << endl;
int x1;
cin >> x1;
cout << "Esbriba el segundo numero" << endl;
int x2;
cin >> x2;
#include <iostream>
using namespace std;
int main(){
int f1, c1;
cout << "---Conversor de Grados Celcuis a Fahrenheit---" << endl;
cout << "" << endl;
cout << "Cual es la temperatura en Fahrenheit: ";
cin >> f1;
c1 = (5*(f1-32)/9);
#include <iostream>
#include <cmath>
using namespace std;
double square_root(double x){
return pow(x, 1.0/2);
}
double square_cube(double x){
return cbrt(x);
}
#include <iostream>
#include <stdlib.h> //liberia que nos ayudara a crear los numeros aleatoreos
using namespace std;
int main()
{
int x1, x2, v=0, c=0;
srand(time(NULL));
x1 = rand()%100+1;
//cout << x1 << endl; // Linea para saber cual es el numero secreto y asi poder probar el programa
#include <iostream>
using namespace std;
int minimunThree(int x, int y, int z){
if (y>=x && z>=x)
return (x);
else if(y<=x && y<=z)
return (y);
else if (z<=x && z<=y)
return (z);
#include <iostream>
using namespace std;
int main(){
int limite1, limite2, i, suma = 0;
cout << "Introdusca el numero menor de la serie: ";
cin >> limite1;
i = limite1;
cout << "Introdusca el numero mayor de la serie: ";
cin >> limite2;
#include <iostream>
using namespace std;
int suma (int x1, int x2){
int z;
return z = x1 + x2;
}
int resta (int x1, int x2){
int z;
return z = x1 - x2;
#include <iostream>
using namespace std;
int factorial(int x){
if (x == 0)
return 1;
else {
int recurso = factorial(x-1);
int res = x * recurso;
return res;
#include <iostream>
#include <stdio.h>
using namespace std;
main()
{ /* PROGRAM TO PRINT OUT SPACE RESERVED FOR VARIABLES */
char c;
short s;
int i;
unsigned int ui;