🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: chile.comp.programacion
Article #1937

Re: Ayuda a programas en C

#1937
From: FARU
Date: Thu, 11 May 2006 05:18
43 lines
2383 bytes
Bueno, esto logre hacer, pero necesito ayuda para modificar el while
para que salga precionando una tecla, por ejemplo 0 y ademas
inplementarlo con funciones, y si es posible que el amarillo tenga un
tiempo diferente (mas corto) de espera.

gracias por las posibles ayudas.


#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
  int cont,ii,i,fin=0,duracion=99999999;
while (fin=1)
{
  for(i=0; i <=2; i++)
  {
    switch(i)
    {
    case 0:
           printf("El semaforo esta ROJO.\n\n");
           for(ii=0; ii <=duracion; ii++)
           { cont++;
             if (cont==duracion)  break;}
           break;
    case 1:
           printf("El semaforo esta VERDE.\n\n");
           for(ii=0; ii <=duracion; ii++)
           { cont++;
             if (cont==duracion)  break;}
            break;
    case 2:
           printf("El semaforo esta AMARILLO.\n\n");
           for(ii=0; ii <=duracion; ii++)
           { cont++;
             if (cont==duracion) break;}
            break; 
    }
  }  
 }
 return 0;
}
Technical Details
Message-ID: <1147324706.497181.64360@u72g2000cwu.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!u72g2000cwu.googlegroups.com!not-for-mail
References: <1147282198.259659.145910@g10g2000cwb.googlegroups.com> <e3ua2i$3u8$2@localhost.localdomain> <1147324536.234592.89500@j73g2000cwa.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,6f5ad54bc4a680c9
X-Google-Attributes: gid1593cb,public
X-Google-Language: SPANISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!u72g2000cwu.googlegroups.com!not-for-mail
From: "FARU" <faruchile@gmail.com>
Newsgroups: chile.comp.programacion
Subject: Re: Ayuda a programas en C
Date: 10 May 2006 22:18:26 -0700
Organization: http://groups.google.com
Lines: 44
Message-ID: <1147324706.497181.64360@u72g2000cwu.googlegroups.com>
References: <1147282198.259659.145910@g10g2000cwb.googlegroups.com>
   <e3ua2i$3u8$2@localhost.localdomain>
   <1147324536.234592.89500@j73g2000cwa.googlegroups.com>
NNTP-Posting-Host: 164.77.190.78
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1147324711 28031 127.0.0.1 (11 May 2006 05:18:31 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 11 May 2006 05:18:31 +0000 (UTC)
In-Reply-To: <1147324536.234592.89500@j73g2000cwa.googlegroups.com>
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: u72g2000cwu.googlegroups.com; posting-host=164.77.190.78;
   posting-account=FeKocw0AAAAsTvP5v0Hv93ZBJ-Dg9IWy