hi I am developing this code which is used to generate a password by taking letters, caps, numbers and symbols from the chars but this error appears to me,even removing the chars as constants the problem persists.
[Error] invalid operands of types 'const char [26]' and 'const char [26]' to binary 'operator+'
Here is the code (it's not finished yet, I want to understand this error first)
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
srand(time(NULL));
const char letter_a[]={'a','b','c','d','e','f','g','h','i','j','k','l','n','m','o','p','q','r','s','t','u','v','w','x','y','z'};
const char caps_letter_a[]={'A' ,'B' ,'C' ,'D' ,'E' ,'F' ,'G' ,'H' ,'I','J','K','L','N','M','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
const char symbol_a[]={'?','!','#','@','*','-','_'};
const int number_a[]={1,2,3,4,5,6,7,8,9,0};
int selection;
bool operation=true;
string letter,caps,symbol,number;
cout<<"Enter password length ";
cin>>selection;
char *password= new char[selection];
bool letter_b=false;
bool caps_letter_b=false;
bool symbol_b=false;
bool number_b=false;
cout<<"do you want to insert letters? type yes o no "<<endl;
cin>>letter;
cout<<"do you want to insert caps letters? type yes o no "<<endl;
cin>>caps;
cout<<"do you want to insert number? type yes o no "<<endl;
cin>>number;
cout<<"do you want to insert symbol? type yes o no "<<endl;
cin>>symbol;
while(operation==true)
{
if(letter=="yes")
{
//cout<<"sono nell'if lettere"<<endl;
if(caps=="yes")
{
//cout<<"sono nell'if caps";
for(int x=0; x<selection ; x++)
{
static char r= letter_a + caps_letter_a + rand()%52+1;
password[x]= r;
}
operation=false;
if(number=="yes")
{
if(symbol=="yes")
{
}
}
}
}
}
cout<<password;
return 0;
}