Advertisement
Guest User

Untitled

a guest
Oct 7th, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.14 KB | None | 0 0
  1. #include <cstdio>
  2. #include <cstring>
  3. #include <cstdlib>
  4. #include <iostream>
  5.  
  6. class Mascara
  7. {
  8.  public:  
  9.  
  10. void mascara(char *mail)
  11. {
  12.   //const char formato[]="@#######.###.##"; // @hotmail.com.br
  13.   //const char formato[]="@#####.###.##"; // @terra.com.br
  14.   //const char formato[]="@#####.###.##"; // @yahoo.com.br
  15.   //const char formato[]="@#####.###"; // @gmail.com
  16.   //const char formato[]="@#######.###"; // @hotmail.com
  17.   const char formato[]="#############@#######.###"; // @hotmail.com  dessa forma sรณ valida a quantidade de 13 digitos antes do @
  18.   char aux[100];
  19.   int i = 0;
  20.   std::cin>>mail;
  21.   while(*mail)
  22.      {
  23.         if(formato[i] != '#')
  24.         {
  25.          aux[i] = formato[i];
  26.          i++;
  27.         }
  28.           else  
  29.         {
  30.          aux[i] = *mail;
  31.           mail++;
  32.          i++;
  33.         }
  34.      }
  35.      aux[i] = 0;
  36.   std::cout<<"\n\tSeu email: "<<std::string(aux)<<"\n\n";
  37. }
  38.  
  39. }masc;
  40.  
  41. int main()
  42. {
  43.  char email[]="";
  44.   std::cout<<"\n\tDigite seu email: ";
  45.  masc.mascara(email);
  46.  /*
  47.  Digite seu email: jeancesar2010hotmailcom
  48.  
  49.         Seu email: jeancesar2010@hotmail.com
  50.  
  51.  
  52.  */
  53.     return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement