hi, first of all, i would like to congratulate u all guys for this beautifull board! looks pretty nice u know...
Im a very loyal member of all boards, so, from now on, ull see me around lotz of times.
My native language is Spanish, but i can handdle my english in a good way...i hope u can understand me.
ok, now, im making a proyect, but i get an error in a line of my code, not when compiling, but when running... the idea of this code is to write a mesagge in an array, then, transfer it into a matrix, and once again, pass it to an other array, colum by colum, but in a very nice way... heres my code, please help me..
OH, by the way, i havent learnded to use poiters, so please dont use any, thanx
thanx in advanced...
----------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <conio.h>
#define tamcla 20
#define tammens 50
#define matfi 50
#define matcol 50
int valmin(struct pass, int);
int mat2mencri(char [matfi][matcol], char [], int, int);
void men2mat(char [], char [matfi][matcol], int);
void show(char [matfi][matcol]);
struct pass {
char car[tamcla];
char ava[tamcla];
};
pass clave;
main(){
int recla, q, r, d;
char mensaje[tammens], basen[matfi][matcol], mencri[tammens];
int min[tamcla];
printf("# of characters for the password:\n");
cin>>recla;
printf("type your password\n");
cin>>clave.car;
printf("type your mesagge\n");
cin>>mensaje;
for (q=0; q<recla; q++){
men2mat(mensaje, basen, recla);
d=valmin(clave, recla);
r=mat2mencri(basen[matfi][matcol], mencri[], d, r)
cout<<d;
getch();
}
system("pause");
}
int mat2mencri(char basen[matfi][matcol], char mencri[], int d, int r){
int h;
for(h=0;h<matfi;h++){
mencri[r]=basen[h][d];
}
return r;
}
void men2mat(char mensaje[], char basen[matfi][matcol], int recla){
int c=0, h,col;
for(h=0, c=0; c<tammens;h++){
for(col=0; col<recla; col++, c++){
basen[h][col]=mensaje[c];
}
}
}
int valmin( pass clave, int recla){
int count;
for (count=0; count<recla; count++){
if ((clave.car[count]< clave.car[(count+1)]) && (clave.ava[count] !='n')){
clave.ava[count]='n';
}
}
return (count);
}
void show (char a[matfi][matcol]) {
int x, j;
for (x=0; x<tammens; x++){
printf("\n");
for (j=0; j<tammens; j++){
printf("%3c",a[x][j]);
}
}
printf("\n");
}