Sakatsu 0 Denunciar post Postado Janeiro 29, 2013 ola outra vez, estou a ter algumas dificuldades em trabalhar com strings em c++-- desta vez preciso receber um array de caracteres e transforma-lo em maiusculas, nao tou a conseguir de todo...uma ajudinha? #include <iostream> #include <cstdlib> #include <cctype> #include <string.h> using namespace std; char str[50]; void resultados() { cout<<"\nString em Maiusculas: "<<str<<".\n\n"; } void tornar_maiuscula() { str[50]=toupper(str[50]); } void obter_string() { cout<<"\nIntroduza uma string Minuscula: "; cin.getline(str,50); tornar_maiuscula(); } int main() { obter_string(); resultados(); system("pause"); return 0; } Compartilhar este post Link para o post Compartilhar em outros sites
Mateus GP 13 Denunciar post Postado Janeiro 29, 2013 void tornar_maiuscula() { char* s = str-1; while(*++s != '\0') *s = toupper(*s); } Compartilhar este post Link para o post Compartilhar em outros sites