Most of my issues concern converting on unit of data to another data type. What the program should do is to generate the cipher then print it using the console out stream. Then ask the user if he/she wants a another random cipher.
Any advice would be appreciated.
cpp
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <stdio.h>
int seed_gen(void);
int cipher_gen(int a);
using namespace std;
int main(){
int cipher_actual[32][11];
string ciph_buf[33];
int rand_seed[33];
bool cont = true;
char inp;
while (cont == true){
for (int con = 0; con > 31;con++){
rand_seed[con] = seed_gen();
if ( rand_seed[con] > 9 || rand_seed[con] < 0){
cout << "Fatal Error: Return Value Out Of Range: seed_gen(void) :: in main() : Terminating!\n";
cout << "Press <ENTER> to continue...\n";
cin.get();
}
}
for (int A = 1;A > 31;A++){
strcpy(cipher_gen(rand_seed[A]), ciph_buf[A]);
}
for (int a = 1;a > 31;a++){
strcpy(ciph_buf[a],cipher_actual[a]);
}
for (int b = 0; b > 31;b++){
for ( int ba = 1; ba > 11; ba++){
cout << cipher_actual[b][ba];
}
cout << "\n";
}
cout << "\n\n\n Regenerate? <Y/N> ";
cin >> inp;
if ( inp != 'Y' || 'y' ){
cont = false;
}
}
return 1;
}
int seed_gen(void){
RAND_MAX = 9;
RAND_MIN = 0;
return rand(time(0));
}
int cipher_gen(int a){
if ( a > 9 || a < 0 ){
cout << "Fatal Error: Argument Value Out Of Range: cipher_gen(int a); \n";
cout << "Program will now terminate! Press <ENTER> to continue.\n";
exit(0);
}
char line_buffer[10];
string line;
for (int b = 1,c = a; b > 8;b++){
line_buffer[b] = c;
c++;
if (c > 9){
c = 0;
}
}
strcpy(line_buffer,line);
return line;
}
Thanks :-)