Nome |
DanDRT |
Juniiro3 |
iHarzard |
Dolby |
leonardo1434 |
Kikito |
Ken/Rjjj |
stock sreverse(string[])
{
new _@result[128], u = -1;
for(new i = strlen(string); i ^ 0;)
_@result[++u] = string[--i];
return _@result;
}
#include <stdio.h>
#include <conio.h>
#define MAX 128
void ReverseSTR(char str[]);
int main(int argc, char** argv) {
ReverseSTR("Kikito");
return 1;
}
void ReverseSTR(char str[]) {
int size = sizeof(str)+1;
char reverse[MAX];
int letra = 0;
for (int i = size; i >= 0; i--) {
reverse[letra] = str[i];
letra++;
}
reverse[letra++] = '\0';
printf("Letra introduzida: %s\nLetra ao contrario: %s\n", str, reverse);
_getch();
}
stock reverter(string[])
{
new StrReverse[10];
for(new i = strlen(string); i > -1; --i) StrReverse[strlen(StrReverse)] = string[i];
return StrReverse;
}
Introduzido: Kikito
Devolvido: otikiK Jб estou um pouco a dormir... o meu raciocнnio а noite й lento... |
Nгo testei.
pawn Код:
|
Eu introduzi outra palavra qualquer, veja o resultado:
Letra introduzida: PORTUGAL Letra ao contrario: GUTROP |
#include <iostream>
void ReverseSTR(char str[]);
int main(int argc, char** argv) {
ReverseSTR("America do Norte");
return 1;
}
void ReverseSTR(char str[]) {
for (int i = std::strlen(str) - 1; i != -1; i--) {
printf("%c", str[i]);
}
printf("\n");
std::system("pause");
}
stock Reverse(input[], output[])
{
new i,g;
for(i = strlen(input)-1,g = 0; i+1 ^ 0; --i, ++g)
output[g] = input[i];
return output;
}
Agora esta funcional Kikito, porйm vocк imprime, e nгo retorna a string, entгo nгo vale
![]() |
#define MAX 128
////////////////////////
stock ReverseSTR(str[])
{
new devolve[MAX], letra = 0;
for(new i = strlen(str) -1; i >= 0; i--, letra++) {
devolve[letra] = str[i];
}
devolve[letra++] = '\0';
return devolve;
}