Supprimer les espaces et les ponctuations d’une chaîne de caractères

Author:


Download

#include 
#include 

int main()
{
   char Str[80] = "l'agorithme de djikstra en C/C++";
   char *pStr1 = Str;
   char *pStr2 = Str;

   while(*pStr1 != '')
   {
     if(ispunct(*pStr1) || isspace(*pStr1))
     {
       ++pStr1;
       continue;
     }
     else
       *pStr2++ = *pStr1++;
   }
   *pStr2 = '';
   printf("%sn", Str);

   return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Supprimer les espaces et les ponctuations d’une chaîne de caractères

Author:


Download

#include 
#include 

int main()
{
   char Str[80] = "l'agorithme de djikstra en C/C++";
   char *pStr1 = Str;
   char *pStr2 = Str;

   while(*pStr1 != '')
   {
     if(ispunct(*pStr1) || isspace(*pStr1))
     {
       ++pStr1;
       continue;
     }
     else
       *pStr2++ = *pStr1++;
   }
   *pStr2 = '';
   printf("%sn", Str);

   return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *