Article View: chile.comp.programacion
Article #1778Ayuda con programa en C
From: FARU
Date: Sun, 14 May 2006 06:48
Date: Sun, 14 May 2006 06:48
52 lines
2239 bytes
2239 bytes
Hola amigos, estoy practicando en C, y tengo una duda, estoy usando un
while y para salir se hace con 0, pero si preciona cualquier letra en
vez de un numero queda en un loop ยฟme ayudan?
ยฟPor que ocurre eso?, estoy intentando de resolverlo pero no entiendo
por que.
#include<stdio.h>
#include<stdlib.h>
int main()
{
int i;
printf("PROGRAMA SALUDO (PARA TERMINAR PRESIONE 0)\n");
while(i != 0)
{
printf("Presione de 1 a 4: ");
scanf("%i",&i);
switch(i)
{
case 0:
printf("FIN DEL PROGRAMA \n");
break;
case 1:
printf("HOLA \n");
break;
case 2:
printf("COMO \n");
break;
case 3:
printf("ESTAS \n");
break;
case 4:
printf("TU \n");
break;
default:
printf("ERROR: PRESIONO TECLA ERRONEA\n");
}
}
system("pause");
return 0;
}
Technical Details
Message-ID:
<1147589312.808179.69320@j33g2000cwa.googlegroups.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!j33g2000cwa.googlegroups.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,ca8f03851255089e,start X-Google-Attributes: gid1593cb,public X-Google-Language: SPANISH,ASCII Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!j33g2000cwa.googlegroups.com!not-for-mail From: "FARU" <feliperamirez@yahoo.com> Newsgroups: chile.comp.programacion Subject: Ayuda con programa en C Date: 13 May 2006 23:48:32 -0700 Organization: http://groups.google.com Lines: 53 Message-ID: <1147589312.808179.69320@j33g2000cwa.googlegroups.com> NNTP-Posting-Host: 200.72.212.70 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1147589317 2035 127.0.0.1 (14 May 2006 06:48:37 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 14 May 2006 06:48:37 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: j33g2000cwa.googlegroups.com; posting-host=200.72.212.70; posting-account=4zPFtw0AAAA1Y7m9NEwyX780gL-Lr57k