I am entering by passing a char
to an array of char
and when inserting it does it well, as I enter and print everything from little to little.
Then I made another for
to show only the arrangement and it turns out that only the last 5 letters of my char
awaits me in everything.
Is that the fix is not maintained. I mean I put information and when I print the fix I get altered the arrangement, 2% range for
: One adds information to the array and prints the array every cycle and the other for
that is dedicated to printing the same array prints me very different, being the case that the 2 are the same arrangement.
I do not know what's wrong.
void Agregar(char Frase[], int Caracteres);
int main()
{
string Texto;
string Texto2;
char Frase[180];
cout<<"Ingresa La Palabra A Encriptar: ";
getline(cin,Texto);
for(int i = 0; Texto[i] != 0;++i){
if(Texto[i] != 32)
Texto2 = Texto2 + Texto[i];
}
cout<<"Sin Espacios: "<<Texto2<<endl;
int Num = Texto2.length();
strcpy(Frase, Texto2.c_str());
int CaracteresRest = 5-(Num%5);
if (CaracteresRest==5)
{
CaracteresRest=0;
}
Agregar(Frase,CaracteresRest);
Num = strlen(Frase);
int Multiplo = Num/5;
cout<<"Con *: "<<Frase<<endl;
cout<<"**Arreglo**"<<endl;
string * arreglo;
arreglo = new string[Multiplo,5];
string *arreglo2 = new string[Multiplo,5];
int ContTex = 0;
for(int i = 0; i < Multiplo; i++){
for(int j = 0; j <5; j++){
arreglo[i,j] = Frase[ContTex];
ContTex = ContTex + 1;
cout<< arreglo[i,j]<<" ";
}
cout<<""<<endl;
}
// delete [] arreglo;
/**El arreglo que imprimo aqui es muy diferente al paso y eso no deberia de pasar**/
cout<<""<<endl;
for(int i = 0; i < Multiplo; i++){
for(int j = 0; j <5; j++){
cout<< arreglo[i,j]<<" ";
}
cout<<""<<endl;
}
}
void Agregar(char Frase[], int Caracteres){
int i=0;
while (Frase[i]!='void Agregar(char Frase[], int Caracteres);
int main()
{
string Texto;
string Texto2;
char Frase[180];
cout<<"Ingresa La Palabra A Encriptar: ";
getline(cin,Texto);
for(int i = 0; Texto[i] != 0;++i){
if(Texto[i] != 32)
Texto2 = Texto2 + Texto[i];
}
cout<<"Sin Espacios: "<<Texto2<<endl;
int Num = Texto2.length();
strcpy(Frase, Texto2.c_str());
int CaracteresRest = 5-(Num%5);
if (CaracteresRest==5)
{
CaracteresRest=0;
}
Agregar(Frase,CaracteresRest);
Num = strlen(Frase);
int Multiplo = Num/5;
cout<<"Con *: "<<Frase<<endl;
cout<<"**Arreglo**"<<endl;
string * arreglo;
arreglo = new string[Multiplo,5];
string *arreglo2 = new string[Multiplo,5];
int ContTex = 0;
for(int i = 0; i < Multiplo; i++){
for(int j = 0; j <5; j++){
arreglo[i,j] = Frase[ContTex];
ContTex = ContTex + 1;
cout<< arreglo[i,j]<<" ";
}
cout<<""<<endl;
}
// delete [] arreglo;
/**El arreglo que imprimo aqui es muy diferente al paso y eso no deberia de pasar**/
cout<<""<<endl;
for(int i = 0; i < Multiplo; i++){
for(int j = 0; j <5; j++){
cout<< arreglo[i,j]<<" ";
}
cout<<""<<endl;
}
}
void Agregar(char Frase[], int Caracteres){
int i=0;
while (Frase[i]!='%pre%')
{
++i;
}
int TamTotal=i+Caracteres;
while (i<TamTotal)
{
Frase[i]='*';
++i;
}
Frase[i]='%pre%';
}
')
{
++i;
}
int TamTotal=i+Caracteres;
while (i<TamTotal)
{
Frase[i]='*';
++i;
}
Frase[i]='%pre%';
}