Created
June 5, 2019 20:57
-
-
Save parzibyte/df936ab26116041f67e9c59c34091bc1 to your computer and use it in GitHub Desktop.
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
/* | |
Funciones paraa convertir una cadena a mayúscula | |
y a minúscula en C++ (CPP) | |
@author parzibyte | |
*/ | |
#include <iostream> | |
using std::string; | |
// Prototipo de funciones | |
string aMayuscula(string cadena); | |
string aMinuscula(string cadena); | |
int main() { | |
string cadena = "Parzibyte.me"; | |
std::cout << "Original: " + cadena; | |
string mayuscula = aMayuscula(cadena); | |
std::cout << "\nMayúscula: " + mayuscula; | |
string minuscula = aMinuscula(cadena); | |
std::cout << "\nMinúscula: " + minuscula; | |
} | |
string aMayuscula(string cadena) { | |
for (int i = 0; i < cadena.length(); i++) cadena[i] = toupper(cadena[i]); | |
return cadena; | |
} | |
string aMinuscula(string cadena) { | |
for (int i = 0; i < cadena.length(); i++) cadena[i] = tolower(cadena[i]); | |
return cadena; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment