Hello daniweb, I've been having problems with a program I'm trying to make, in my function definitions, I'm trying to reference the output of one function in the other's definition, but not sure how to, I'm guessing pointers could help me but I'm not sure how to use them:
These are the two functions:
string inputsentance(){
string sentance;
cout<< "inputsentance";
cin>> sentance;
return sentance;
string genstring()
{
string generated_string;
for (int k=0;k<sentance.size();k++ ) // I want it to use "sentance" from the function above
{
char c = rand() % 27 + 'A'; //random from "A-["
if( c == '[' )
c = ' ';
generated_string.append(1, c);
}//cout << generated_string;
return generated_string;
}
int main(){
srand(time(0));
string sentance;
inputsentance();
genstring();
return 0;
}
}
Is it possible to reference locations in definitions like this?
Many Thanks