Invierte una parte o todo de una cadena de caracteres.
#include "stdafx.h"
#include "iostream"
#include "conio.h"
using namespace std;
void invertirCadena(char *cad,int i,int j)
{
if(i<j)
{
char temp=cad[i];
cad[i]=cad[j];
cad[j]=temp;
invertirCadena(cad,i+1,j-1);
}
}
void main()
{
char cad[100];
cout<<"Ingrese una cadena (sin espacios): ";cin>>cad;
invertirCadena(cad,0,strlen(cad)-1);//Parametros (Límite inferior,Límite superior), strlen extrae el tamaño de la cadena
cout<<endl<<"Cadena invertida: "<<cad;
_getch();
}
People have switched to on-line platforms to have fun and enhance their notes in the financial institution as well. There are many Casino Online Games in South Korea, together with desk video games and 1xbet korea slots. These video games come with profitable bonuses to assist gamers wager with out placing their bankroll in danger.
ResponderEliminar