Fandom

Scratchpad

PLE:Unidad4Ejercicio16

219,292pages on
this wiki
Add New Page
Discuss this page0 Share
/*
Programa:       Unidad4Ejercicio16.cpp
Descripción:    Utiliza las funciones de <cctype>.
*/
#include <iostream>
#include <cctype>
using namespace std;

void main ()
{
        char c=10;

        cout << "Introduzca un caracter ";
        cin >> c;

        cout << "El caracter mayúscula es " << (char) toupper(c) << endl;
        cout << "El caracter minúscula es " << (char) tolower(c) << endl;

        if(isalnum(c))
                cout << "Es un caracter alfanumérico " << endl;
        else
                cout << "No es un caracter alfanumérico " << endl;

        if(isalpha(c))
                cout << "Es un caracter alfabetico " << endl;
        else
                cout << "No es un caracter alfabetico " << endl;


        if(iscntrl(c))
                cout << "Es un caracter de control " << endl;
        else
                cout << "No es un caracter de control " << endl;


        if(isdigit(c))
                cout << "Es un digito " << endl;
        else
                cout << "No es digito " << endl;

        if(isgraph(c))
                cout << "Es un caracter con representación gráfica " << endl;
        else
                cout << "No es un caracter con representación gráfica " << endl;


        if(islower(c))
                cout << "Es un caracter minúscula " << endl;
        else
                cout << "No es un caracter minúscula " << endl;

        if(isupper(c))
                cout << "Es un caracter mayúscula " << endl;
        else
                cout << "No es un caracter mayúscula " << endl;


        if(isprint(c))
                cout << "Es un caracter imprimible " << endl;
        else
                cout << "No es un caracter imprimible " << endl;


        if(ispunct(c))
                cout << "Es un caracter de puntuación " << endl;
        else
                cout << "No es un caracter de puntuación " << endl;

        if(isspace(c))
                cout << "Es un caracter de espaciado " << endl;
        else
                cout << "No es un caracter de espaciado " << endl;

        if(isxdigit(c))
                cout << "Es un dígigo hexadecimal " << endl;
        else
                cout << "No es dígigo hexadecimal " << endl;

        cin.ignore();
        cin.get();
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random wikia