Jump to content
Gurzi

Algumas Funções de Strings

Recommended Posts

Gurzi

Bem malta, vou deixar aqui algo básico mas que pode ajudar algumas pessoas :P

Vou deixar funções que faço sozinho seguindo os problemas do Livro do Damas :)

Espero que possa ser útil futuramente :P

Função updown(vai colocar a string introduzida assim " Eu GoStO dO pOrTuGaL a ProGrAmAr" )

char *updown(char *s)
{
  int i=0;
  for (i=0;s[i]!='\0';i++)
  {
   if(i%2 == 0)
   s[i] = toupper(s[i]);
  else
  s[i] = tolower(s[i]);
  }
return s;
}

-----------------------tem que utilizar a biblioteca ctype.h--------------------------

:P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.