| Ver tema anterior :: Ver siguiente tema | | Autor | Mensaje |
|---|
CoMN2
Registrado: 25 Sep 2007 Mensajes: 3 Ubicación: Rancagua -Chile
| Publicado: 27/09/2007 7:15 pm | | | Título: validar letras |
| necesito ayuda!!!! 
como se valida letras no logro validar letras desde la a hasta la z si me pueden ayudarme porfavor 
#include <process.h> #include <stdio.h>
void main (void){ char nom[15]; int opc,opc1,opc2,opc3,opc4,opc5,cn,pre,od,si,sl,sl2,td,dt,ht,vht,he,vhe,si2,td2,td3,di,d; int desc,uf; char mes[10],sn,sn2,sn3,sn4; system("color A"); printf("\n\n\n"); printf(" 00000 00000 00 00 000000 00000 000000 00000 00 00 00000 00000\n"); printf(" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \n"); printf(" 00 00 00 000 00 00 00 00 00 00 00 000 000 00 00 00 \n"); printf(" 00000 00000 00 0 00 00 00 00 00 00 00 0000000 00000 00000\n"); printf(" 00 00 00 00 000 00 00 00 00 00 00 00 0 00 00 00 00\n"); printf(" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n"); printf(" 00000 00 00 00 00 00 00000 00 00000 00 00 00 00 00000\n"); printf("\n\n\n\n\t\t"); printf("\t PRESENTA\n"); printf("\t\t----------------------------------------"); printf("\n\t\tNOMBRES : Osvaldo Tello\n"); printf("\n\t\t Claudio Castro\n"); printf("\n\t\t Alejandro Rosel\n"); printf("\n\t\tCURSO : PROGRAMACION 1\n"); printf("\n\t\tPROFESORA: KATHERINE AREVALO\n\n"); printf("\t\tPROGRAMA DE INGRESO DE TRABAJADORES\n"); printf("\t\t----------------------------------------\n\n\n\n\n"); printf("\t\t"); system("pause");
menu: system("cls"); printf("\n\n\t\t\t\tMENU PRINCIPAL\n"); printf("\n\t\t\t1) LISTADO\n"); printf("\n\t\t\t2) COLILLA DE SUELDO\n"); printf("\n\t\t\t3) SALIR\n"); printf("\n\n\t\t\t\tINGRESE LA OPCION\t ");
do{
scanf("%d",&opc);
}while(opc!=1 && opc!=3 && opc!=2);
if(opc==1){ ingreso2: system("cls"); printf("----------------------------***INGRESO DE DATOS***---------------------------------"); printf("\n\n\t\tNOMBRE TRABAJADOR:"); scanf("%s",&nom); printf("\n\n\t\tSUELDO IMPONIBLE :"); scanf("%i",&si);
system("cls"); printf("\n\t\t\t\tMENU AFP\n"); printf("\n\t\t\t1) PROVIDA\n"); printf("\n\t\t\t2) HABITAT\n"); printf("\n\t\t\t3) MAGISTER\n"); printf("\n\t\t\t4) CUPRUM\n"); printf("\n\n\t\t\t\tINGRESE LA OPCION\t "); do{
scanf("%i",&opc1);
}while(opc1!=1 && opc1!=2 && opc1!=3 && opc1!=4);
if(opc1==1){
desc=si*0.13;
}
if(opc1==2){
desc=si*0.125;
}
if(opc1==3){
desc=si*0.138;
}
if(opc1==4){
desc=si*0.07; }
system("cls"); printf("\n\t\t\t\tMENU SALUD\n"); printf("\n\t\t\t1) FUSAT\n"); printf("\n\t\t\t2) ISAMEDICA\n"); printf("\n\t\t\t3) CRUZ BLANCA\n"); printf("\n\t\t\t4) CONSALUD\n"); printf("\n\t\t\t5) FONASA\n"); printf("\n\n\t\t\t\tINGRESE LA OPCION\t"); do{
scanf("%i",&opc2);
}while(opc2!=1 && opc2!=2 && opc2!=3 && opc2!=4 && opc2!=5);
if(opc2==1){
uf=2.3*16925;
}
if(opc2==2){
uf=2.9*16925;
}
if(opc2==3){
uf=2.5*16925;
}
if(opc2==4){
uf=3.7*16925;
}
if(opc2==4){
uf=(si*7)/100;
}
system("cls"); printf("\n\t\t\t OTRO DESCUENTO\n");
printf("\n\t\t\tCOMITE NAVIDAD : "); scanf("%i",&cn); printf("\n\t\t\tPRESTAMOS : "); scanf("%i",&pre); printf("\n\t\t\tDIFERENCIA ISAPRE: "); scanf("%i",&d); od=cn+pre+d; td=desc+uf+od; sl=si-td; system("cls");
if(sl>=0&&sl<=200000){
printf("\n-nombre-sueldo imp-$AFP-$salud-$otro desc-$total desc-sueldo liq-categoria-\n"); printf("-------------------------------------------------------------------------------\n"); printf("%s\t%i\t%i\t%i\t%i\t%i\t%i",nom,si,desc,uf,od,td,sl);printf("\t\tA"); printf("\n\n\n\n\n\n\n\n\n\t\t"); printf("DESEA SEGUIR INGRESANDO DATOS S/N "); do{ scanf("%c",&sn4);
}while(sn4!='s' && sn4!='S' && sn4!='n' && sn4!='N');
if(sn4=='s' || sn4=='S'){
goto ingreso2;
}else{
goto menu;
}
}
if(sl>=200001&&sl<=450000){
printf("\n-nombre-sueldo imp-$AFP-$salud-$otro desc-$total desc-sueldo liq-categoria-\n"); printf("-------------------------------------------------------------------------------\n"); printf("%s\t%i\t%i\t%i\t%i\t%i\t%i",nom,si,desc,uf,od,td,sl);printf("\t\tB"); printf("\n\n\n\n\n\n\n\n\n\t\t"); printf("DESEA SEGUIR INGRESANDO DATOS S/N "); do{ scanf("%c",&sn4);
}while(sn4!='s' && sn4!='S' && sn4!='n' && sn4!='N');
if(sn4=='s' || sn4=='S'){
goto ingreso2;
}else{
goto menu;
}
}
if(sl>=450001&&sl<=880500){
printf("\n-nombre-sueldo imp-$AFP-$salud-$otro desc-$total desc-sueldo liq-categoria-\n"); printf("-------------------------------------------------------------------------------\n"); printf("%s\t%i\t%i\t%i\t%i\t%i\t%i",nom,si,desc,uf,od,td,sl);printf("\t\tC"); printf("\n\n\n\n\n\n\n\n\n\t\t"); system("pause"); printf("DESEA SEGUIR INGRESANDO DATOS S/N\n "); do{ scanf("%c",&sn4);
}while(sn4!='s' && sn4!='S' && sn4!='n' && sn4!='N');
if(sn4=='s' || sn4=='S'){
goto ingreso2;
}else{
goto menu;
}
}
if(sl>=880501&&sl<=1300000){
printf("\n-nombre-sueldo imp-$AFP-$salud-$otro desc-$total desc-sueldo liq-categoria-\n"); printf("-------------------------------------------------------------------------------\n"); printf("%s\t%i\t%i\t%i\t%i\t%i\t%i",nom,si,desc,uf,od,td,sl);printf("\t\tD"); printf("\n\n\n\n\n\n\n\n\n\t\t"); system("pause"); printf("DESEA SEGUIR INGRESANDO DATOS S/N "); do{ scanf("%c",&sn4);
}while(sn4!='s' && sn4!='S' && sn4!='n' && sn4!='N');
if(sn4=='s' || sn4=='S'){
goto ingreso2;
}else{
goto menu;
}
}
if(sl>=1300001&&sl<=1000000000000000000){
printf("\n-nombre-sueldo imp-$AFP-$salud-$otro desc-$total desc-sueldo liq-categoria-\n"); printf("-------------------------------------------------------------------------------\n"); printf("%s\t%i\t%i\t%i\t%i\t%i\t%i",nom,si,desc,uf,od,td,sl);printf("\t\tE"); printf("\n\n\n\n\n\n\n\n\n\t\t"); system("pause"); printf("DESEA SEGUIR INGRESANDO DATOS S/N "); do{ scanf("%c",&sn4);
}while(sn4!='s' && sn4!='S' && sn4!='n' && sn4!='N');
if(sn4=='s' || sn4=='S'){
goto ingreso2;
}else{
goto menu;
}
}
}
if(opc==2){ ingreso: system("cls"); printf("-------------------------------------------------------------------------------"); printf("\n----------------------***INGRESO DE DATOS DEL TRABAJADOR***------------------"); printf("\n-----------------------------------------------------------------------------"); printf("\n\n"); printf("\t\tNOMBRE TRABAJADOR : "); scanf("%s",&nom); printf("\n"); printf("\t\tMES : "); scanf("%s",&mes); printf("\n"); printf("\t\tDIAS TRABAJADOS : "); scanf("%i",&dt); printf("\n"); printf("\t\tHORAS TRABAJADAS : "); scanf("%i",&ht); printf("\n"); printf("\t\tVALOR HORAS TRABAJADAS : "); scanf("%i",&vht); printf("\n"); printf("\t\tHORAS EXTRAORDINARIAS : ");
scanf("%i",&he);
printf("\n"); printf("\t\tVALOR HORAS EXTRAODINARIAS : "); scanf("%i",&vhe);
si2=ht*vht+he*vhe;
system("cls"); printf("\n\t\t\t\tMENU AFP\n"); printf("\n\t\t\t1) PROVIDA\n"); printf("\n\t\t\t2) HABITAT\n"); printf("\n\t\t\t3) MAGISTER\n"); printf("\n\t\t\t4) CUPRUM\n"); printf("\n\n\t\t\t\tINGRESE LA OPCION\t "); do{
scanf("%i",&opc3);
}while(opc3!=1 && opc3!=2 && opc3!=3 && opc3!=4);
if(opc3==1){
desc=si2*0.13;
}
if(opc3==2){
desc=si2*0.125;
}
if(opc3==3){
desc=si2*0.138;
}
if(opc3==4){
desc=si2*0.07; }
system("cls"); printf("\n\t\t\t\tMENU SALUD\n"); printf("\n\t\t\t1) FUSAT\n"); printf("\n\t\t\t2) ISAMEDICA\n"); printf("\n\t\t\t3) CRUZ BLANCA\n"); printf("\n\t\t\t4) CONSALUD\n"); printf("\n\t\t\t5) FONASA\n"); printf("\n\n\t\t\t\tINGRESE LA OPCION\t "); do{
scanf("%i",&opc4);
}while(opc4!=1 && opc4!=2 && opc4!=3 && opc4!=4 && opc4!=5);
if(opc4==1){
uf=2.3*16925;
}
if(opc4==2){
uf=2.9*16925;
}
if(opc4==3){
uf=2.5*16925;
}
if(opc4==4){
uf=3.7*16925;
}
if(opc4==4){
uf=(si2*7)/100;
}
descuentos: system("cls"); printf("\n\t\t\t\tMENU OTRO DESCUENTO$\n"); printf("\n\t\t\t\t--------------------"); printf("\n\t\t\t1) $ DIFERENCIA ISAPRE\n"); printf("\n\t\t\t2) $ COMITE NAVIDAD\n"); printf("\n\t\t\t3) $ PRESTAMOS\n"); printf("\n\t\t\t4) NIMGUNO\n"); printf("\n\t\t\t5) IMPRIMIR COLILLA\n"); printf("\n\n\t\t\t\tINGRESE LA OPCION\t "); do{
scanf("%i",&opc5);
}while(opc5!=1 && opc5!=2 && opc5!=3 && opc5!=4 && opc5!=5);
if(opc5==1){
system("cls"); printf("\n\t\t\t\t$DIFERENCIA ISAPRE\n"); printf("\n\t\t\t\t------------------"); printf("\n\n\t\t\t\tINGRESE VALOR "); scanf("%i",&di); printf("\n\n\n\t\tDESEA HACER MAS DESCUENTOS S/N "); do{
scanf("%c",&sn3);
}while(sn3!='n' && sn3!='N' && sn3!='s' && sn3!='S');
if(sn3=='s' || sn=='S'){
goto descuentos;
}else{
goto imprimir;
} }
if(opc5==2){
system("cls"); printf("\n\t\t\t\t$ COMITE NAVIDAD"); printf("\n\t\t\t\t---------------"); printf("\n\n\t\t\t\tINGRESE VALOR "); scanf("%i",&cn); printf("\n\n\n\t\tDESEA HACER MAS DESCUENTOS S/N "); do{
scanf("%c",&sn3);
}while(sn3!='n' && sn3!='N' && sn3!='s' && sn3!='S');
if(sn3=='s' || sn=='S'){
goto descuentos;
}else{
goto imprimir;
}
}
if(opc5==3){
system("cls"); printf("\n\t\t\t\t$ PRESTAMOS\n"); printf("\n\t\t\t\t----------"); printf("\n\n\t\t\t\tINGRESE VALOR "); scanf("%i",&pre); printf("\n\n\n\t\tDESEA HACER MAS DESCUENTOS S/N "); do{
scanf("%c",&sn3);
}while(sn3!='n' && sn3!='N' && sn3!='s' && sn3!='S');
if(sn3=='s' || sn=='S'){
goto descuentos;
}else{
goto imprimir;
} }
if(opc5==4){
}
if(opc5==5){
imprimir: td2=cn+pre; td3=td2+uf+desc; sl2=si2-td3; system("cls");
printf("-------------------------------------------------------------------------------"); printf("\n--------------------------***COLILLA DE SUELDO***----------------------------"); printf("\n-----------------------------------------------------------------------------"); printf("\n"); printf("\n\t\t\tNOMBRE : %s",nom); printf("\n\n\t\t\tMES : %s",mes); printf("\n\n\t\t\tDIAS TRABAJADOS : %i",dt); printf("\n\n\t\t\t$ AFP : $%i",desc); printf("\n\n\t\t\t$ SALUD : $%i",uf); printf("\n\n\t\t\t$ DESCUENTOS : $%i",td2); printf("\n\n\t\t\t$ SUELDO IMPONIBLE : $%i",si2); printf("\n\n\t\t\t$ TOTAL DESCUENTO : $%i",td3); printf("\n\n\t\t\t$ SUELDO LIQUIDO : $%i",sl2); printf("\n"); printf("\n\n\t\tDESEA IR AL MENU PRINCIPAL S/N ");
do{
scanf("%c",&sn2);
}while(sn2!='n' && sn2!='N' && sn2!='s' && sn2!='S');
if(sn2=='S' || sn2=='s'){
goto menu;
}else{
goto ingreso;
}
}
}
if(opc==3){
system("cls"); printf("\n\n\n\n\t\t\tESTA SEGURO DE SALIR? S/N "); do{ scanf("%c",&sn); }while(sn!='n' && sn!='N' && sn!='s' && sn!='S');
if(sn=='s' || sn=='S'){
goto fin;
}else{
goto menu; }
}
fin: system("cls"); printf("\n\n\n\n\n\t\t\t***GRACIAS POR USAR ESTE SOFTWARE***\n\n\n\n\t\t\t"); printf("\n\tCUALQUIER DUDA MANDAR E-MAIL A \n"); printf("\t\n\n\t\t\t***FINALIZADO***\n\n\n\t\t\t"); system("pause");
} |
| | Volver arriba | |  | rir3760

Registrado: 01 Oct 2004 Mensajes: 3676 Ubicación: Mexico
| Publicado: 27/09/2007 10:11 pm | | | Título: |
| Cuando tengas una duda o pregunta sobre uno de tus programas es importante que indiques el lenguaje, compilador y plataforma que utilizas.
Tienes que mejorar el programa de forma sustantiva ya que este tiene muchas deficiencias como el uso de goto y constantes enteras como 1,000,000,000,000,000,000 (el maximo valor de un entero sin signo consistente en 32 bits (lo usual) es 4,294,967,295).
Con un programa tan largo seria conveniente que indicaras en que parte esta el error o problema.
Por ultimo si te refieres a leer un caracter y verificar que este sea alfabetico puedes utilizar fgets (prototipo en stdio.h) para leer una linea completa de texto y a continuacion verificar que su primer caracter sea alfabetico mediante la funcion isalpha (prototipo en ctype.h).
Un saludo _________________ The capacity to learn is a gift; The ability to learn is a skill; The willingness to learn is a choice. -- Rebec of Ginaz |
| | Volver arriba | |  | CoMN2
Registrado: 25 Sep 2007 Mensajes: 3 Ubicación: Rancagua -Chile
| Publicado: 28/09/2007 7:28 am | | | Título: validacion de letras |
| c++
 |
| | Volver arriba | |  | | rir3760

Registrado: 01 Oct 2004 Mensajes: 3676 Ubicación: Mexico
| Publicado: 28/09/2007 3:38 pm | | | Título: |
| En este momento y considerando el estado de tu primer programa lo mejor que puedes hacer es desarrollar uno nuevo tan pequeño como sea posible y que demuestre el problema que tienes para validar letras. Tambien deberias explicar con mas detalle a que te refieres con eso, supongo que se puede realizar con las funciones que te mencione antes pero no esta claro si se trata de una cadena de texto o un solo caracter.
Un saludo _________________ The capacity to learn is a gift; The ability to learn is a skill; The willingness to learn is a choice. -- Rebec of Ginaz |
| | Volver arriba | |  | CoMN2
Registrado: 25 Sep 2007 Mensajes: 3 Ubicación: Rancagua -Chile
| Publicado: 16/10/2007 7:22 pm | | | Título: el validar letras |
| gracias en todo caso ya solucione el problema  |
| | Volver arriba | |  | | |
| No puede crear mensajes No puede responder temas No puede editar sus mensajes No puede borrar sus mensajes No puede votar en encuestas
|
|
| |