I have no idea why it doesn't work. What is more I can't even say what are errors about ;/ Can any1 explain what are errors about?
The code is suposed to : create a string with word like - mom. then create 2d array to fill it by string. Free spaces fill with _.So mom box =
[m] [o]
[m] [_]
now fill next array with text that follows from colums. mom_ filled to new array will look like mmo_. Then I cout crypted text. I hope u understood whatI did there :D
here is code
//wal = kolumny=wiersze
#include <cstdlib>
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
void pole(int &a,const int &l);
void tab(const char &s[],char &d[], char &f[],const int a);
int main(){
string code;
cin >> code;
int wall=1;
int d=code.length();
char tekst[d];
pole(wall,d);
strcpy(tekst,code);
char kw[wall][wall];
char szyfr[d];
tab(tekst,kw,szyfr,wall);
for (int i=0;i<d;i++)
cout << szyfr[i] << endl;
system("PAUSE");
return 0;
}
void pole(int &a,const int &l){
if (a*a < l)
pole(a+=1,l);
}
void tab(const char &s[],char &d[], char &f[],const int a){
int i=0;
for (int x=0;x<a;x++,i++){
for (int y=0;y<a;y++,i++){
if(s[i])
d[x][y]=s[i];
else d[x][y]=='_';
f[i]=d[x][y];
}
}
}