🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fr.comp.lang.c
Article #15226

Re: rot13 [Was : Re: conjugaison et autres ...]

#15226
From: candide
Date: Sun, 02 Oct 2005 18:52
42 lines
2537 bytes
"Emmanuel Delahaye" <emdel@YOURBRAnoos.fr> wrote in
news:mn.128c7d5aa5238de0.15512@YOURBRAnoos.fr: 


> Lid�e est de cr�er 2 tables avec tous les caract�res (A-Z) et (a-z),
> et de chercher dedans la position 'i' du caract�re avec strchr().
> Ensuite, on va chercher le caract�re � (i + 13) % 26...
> 
> Pour chercher dans la bonne table, on utilise les filtres isprint(), 
> isnum(), ispunct(), isupper() (<ctype.h>) etc. Jamais la valeur des 
> caract�res.
> 

Chaud / froid ?

/*--------------- rot13.c (2eme version) -----------------*/
#include <stdio.h>
#include <ctype.h>


int main(void)
{
    char minus[]="abcdefghijklmnopqrstuvwxyzabcdefghijklm";
    char majus[]="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM";
    char phrase[200]="Preface : The computing world has undergone a 
revolution since the publication of \"The C Programming Language\" in 
1978.";
    int i=0;
    char *p;
    
     while (phrase[i]!='\0') {
                     if (islower(phrase[i])) 
                     {p=strchr(minus,phrase[i]); printf("%c",*(p+13));}
                     else if (isupper(phrase[i])) 
                     {p=strchr(majus,phrase[i]); printf("%c",*(p+13));}
                     else printf("%c",phrase[i]);
                     i++;
                     }
       
   return 0;
}
/*----------------------------------------------------------*/
Technical Details
Message-ID: <43402c57$0$1702$8fcfb975@news.wanadoo.fr>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!proxad.net!193.252.118.146.MISMATCH!news.wanadoo.fr!news.wanadoo.fr!not-for-mail
References: <1126342327.583568.21420@g43g2000cwa.googlegroups.com> <4329e5d4$0$7846$8fcfb975@news.wanadoo.fr> <dge4b6$fqa$1@reader1.imaginet.fr> <432ab809$0$1734$8fcfb975@news.wanadoo.fr> <mn.84b07d59016a857b.31483@laposte.net> <433f16ac$0$27406$8fcfb975@news.wanadoo.fr> <mn.10907d5a55119e84.15512@YOURBRAnoos.fr> <433f9cb1$0$7821$8fcfb975@news.wanadoo.fr> <mn.128c7d5aa5238de0.15512@YOURBRAnoos.fr>

Show Full Headers
Complete Article Headers
X-Google-Thread: f9822,b21b26167a936e28
X-Google-Attributes: gidf9822,public
X-Google-Language: FRENCH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!proxad.net!193.252.118.146.MISMATCH!news.wanadoo.fr!news.wanadoo.fr!not-for-mail
Newsgroups: fr.comp.lang.c
Subject: Re: rot13 [Was : Re: conjugaison et autres ...]
From: candide <candide@domain.invalid>
References: <1126342327.583568.21420@g43g2000cwa.googlegroups.com> <4329e5d4$0$7846$8fcfb975@news.wanadoo.fr> <dge4b6$fqa$1@reader1.imaginet.fr> <432ab809$0$1734$8fcfb975@news.wanadoo.fr> <mn.84b07d59016a857b.31483@laposte.net> <433f16ac$0$27406$8fcfb975@news.wanadoo.fr> <mn.10907d5a55119e84.15512@YOURBRAnoos.fr> <433f9cb1$0$7821$8fcfb975@news.wanadoo.fr> <mn.128c7d5aa5238de0.15512@YOURBRAnoos.fr>
User-Agent: Xnews/5.04.25
Date: 02 Oct 2005 18:52:07 GMT
Lines: 45
Message-ID: <43402c57$0$1702$8fcfb975@news.wanadoo.fr>
Organization: les newsgroups par Wanadoo
NNTP-Posting-Date: 02 Oct 2005 20:52:07 CEST
NNTP-Posting-Host: 81.250.102.125
X-Trace: 1128279127 news.wanadoo.fr 1702 81.250.102.125:2188
X-Complaints-To: abuse@wanadoo.fr