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
// 03.grades.cpp | |
// Switch example through student grades | |
#include <iostream> | |
#include <cctype> | |
using namespace std; | |
int main( ) | |
{ | |
char grade; |
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
Switch example through student grades |
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
// fibonacci.cpp | |
// juanfc 2012-10-22 | |
// Diseña un algoritmo que lea un núero n por teclado y calcule el n-simo | |
// número de la serie de Fibonacci. Los dos primeros números de esta | |
// serie son el cero y el uno, y a partir de éstos cada número se | |
// calcula realizando la suma de los dos anteriores: | |
// F(n)=F(n−1)+F(n−2), F(0)=1, F(1)=1 | |
// 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, … | |
#include <iostream> |
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
// primosimple.02.cpp | |
// juanfc 2011-10-11 | |
// Averiguar por divisiones sucesivas | |
// si un número dado es o no primo | |
#include <iostream> | |
using namespace std; | |
bool esPrimo(unsigned n); |
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
// zeller.cpp | |
// juanfc 2012-10-22 | |
// Mediante la Congruencia_de_Zeller averiguar | |
// qué día de la semana es cualquier fecha posterior al | |
// 4 de octubre de 1582 | |
// Usa: http://es.wikipedia.org/wiki/Congruencia_de_Zeller | |
// y http://es.wikipedia.org/wiki/Calendario_gregoriano | |
#include <iostream> | |
using namespace std; |
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
// maxminhasta0.cpp | |
// juanfc 2012-06-24 | |
// | |
#include <iostream> | |
using namespace std; | |
void maxmin(int& min, int& max); | |
int main() |
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
// sumartodo.cpp | |
// juanfc 2012-06-24 | |
// | |
#include <iostream> | |
using namespace std; | |
float sumartodo(); | |
int main() |
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
// zeller.cpp | |
// juanfc 2012-10-22 | |
// Mediante la Congruencia_de_Zeller averiguar | |
// qué día de la semana es cualquier fecha posterior al | |
// 4 de octubre de 1582 | |
// Usa: http://es.wikipedia.org/wiki/Congruencia_de_Zeller | |
// y http://es.wikipedia.org/wiki/Calendario_gregoriano | |
#include <iostream> | |
using namespace std; |
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
const int N = 10; | |
const int M = 100; | |
typedef int TMatriz[N][M]; | |
void Encuentrax(TMatriz m, int x, int& pi, int& pj) | |
{ | |
pi = pj = -1; | |
int j, i = 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
// konesinarow2.cpp | |
// juanfc 2012-06-24 | |
// Design a program that reads from keyboard two natural numbers $k$ and | |
// $n$ and sends to the screen a message that indicates whether $n$ has | |
// got at least $k$ 1s (ones) straight without a break, or not. For example, | |
// if $k=3$ and $n=135$ the program should display ‘Yes’ since 135 as binary | |
// is ‘1000 0111’ that does have at least 3 ones in a row. | |
// One loop only (boolean helped) |