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
// nointercambio.cpp | |
// juanfc 2012-06-24 | |
// | |
#include <iostream> | |
using namespace std; | |
void intercambio(int& a, int& b) | |
{ | |
int temp = a; |
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-12.forloopsum.cpp | |
#include <iostream> | |
using namespace std; | |
const int TOP = 1000; | |
int main() | |
{ | |
int sum = 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
// 11.sumuntil0.cpp | |
// juanfc 2011-10-21 | |
// Ask for numbers until 0 is entered | |
// sum all the entered numbers | |
#include <iostream> | |
using namespace std; | |
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
// 15.histogram.cpp | |
// juanfc 2009-10-30 | |
// ask for numbers until 0, making a simple histogram with them | |
// It looks better if you enter all the numbers in a row. Ex: | |
// 1 2 4 5 6 4 3 2 7 8 9 10 0 | |
#include <iostream> | |
using namespace std; | |
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
// 02.esprimo_simple.cpp | |
// juanfc 2009-10-16 | |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
cout << "Please enter an integer: "; | |
int n; | |
cin >> 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
// functioncalls.cpp | |
// juanfc 2012-06-24 | |
// funny example of a chain of calls to subprograms | |
#include <iostream> | |
using namespace std; | |
// Prototypes | |
void a(); | |
void 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
// ecu2gradofun.cpp | |
// juanfc 2009-11-07 | |
// | |
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
enum TIPOEC {CUALX, ABSURDA, PRIMERG, DOBLE, IMAG, DOSSOLS}; |
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
// ec2gradoPlana.cpp | |
// juanfc 2010-10-20 | |
// | |
// Resuelve ecuaciones del tipo ax2 + bx + c=0 | |
#include <iostream> | |
#include <cmath> | |
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
// 02.Balance.cpp | |
// from Savitch | |
// How long does it take (in months) to accumulate a debt | |
// of €100 starting with a debt of €50 and being charged with | |
// 2% each months? | |
#include <iostream> | |
using namespace std; | |
// consts | |
const float STARTING_DEBT = 50.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
// 03.fact.cpp | |
// juanfc 2003-11-11 | |
// How long can an integer be: | |
// for loop to compute a factorial | |
#include <iostream> | |
using namespace std; | |
int main() | |
{ |
OlderNewer