This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
main(){ | |
cout << " C" << endl; | |
cout << " i I" << endl; | |
cout << " s s" << endl; | |
cout << " b b" << endl; | |
cout << " e e" << endl; | |
cout << " s s" << endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
main(){ | |
int x1,x2,x3; | |
cout << "\tIntroduce tres numeros para acomodarlos de menor a mayor\n"; | |
cout << "Numero 1: "; cin >> x1; | |
cout << "Numero 2: "; cin >> x2; | |
cout << "Numero 3: "; cin >> x3; | |
cout << endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
main(){ | |
char a; int b; float c; int d; | |
cout << "Por favor introdusca un caracter: "; | |
cin >> a; | |
cout << "Por favor introdusca numero entero: "; | |
cin >> b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
main (){ | |
int anno; | |
cout << "Introduce un año de 4 dijitos para saber si es bisiesto: "; | |
cin >> anno; | |
if (anno < 1752) | |
cout << "No hay años bisiestos antes de 1752" << endl; | |
else if (anno%4 == 0 && (anno%100 != 0 || anno%400==0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <math.h> | |
using namespace std; | |
main(){ | |
float numeros [10]; | |
float suma =0, prom =0, desv, desv1; | |
cout << "Introduce 10 numeros para saber la suma, el promedio, y desviación estandar: " << endl; | |
for (int i =0; i <10; i++){ | |
cin >> numeros[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int fibonacci (int n){ | |
if (n==0) | |
return 0; | |
else if (n==1 || n== 2) | |
return 1; | |
else{ | |
return fibonacci (n-1) + fibonacci (n-2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int fibonacci (int n){ | |
int i, primero = 0, segundo =1, resul =0; | |
for (i=1; i<n; i++){ | |
resul = primero + segundo; | |
primero = segundo; | |
segundo = resul; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <string> | |
using namespace std; | |
int main (){ | |
int palabras=0, lineas=0; | |
const string nfichero = "texto.txt"; | |
string cadena; | |
ifstream fichero; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
float distance(float x1,float y1,float x2,float y2){ | |
float d = sqrt(pow((x2-x1),2)+pow((y2-y1),2)); | |
return d; | |
} | |
main(){ |