[ create a new paste ] login | about

Link: http://codepad.org/pjELo4bE    [ raw code | fork ]

C, pasted on Dec 8:
#include <stdio.h>
#include <stdlib.h>

int main () {
    char x;
    printf ( "Introduce R o S para seguir\n\n" );
    scanf ( "%c%*c", &x );
    
    while ( x != 'R' && x != 'S' ) {
        //scanf ( "%c", &x ); Al poner %*c ya no necesitamos esto por que enter no estara en el buffer
        printf ( "La letra introducida no fue R ni S\n" );
        scanf ( "%c%*c", &x ); //aqui hacemos lo mismo... Ponemos el %*c
    }
    
    switch ( x ) {
        case 'R': printf ( "Lunes\n\n" ); break;
        
        case 'S': printf ( "Martes\n\n" ); break;
    } 
    system ( "pause" );
    
    return 0;
}


Create a new paste based on this one


Comments: