I'm attempting to do something like this.
class testClass {
public:
void testFunction(char charArray[])
{
char output[].append(charArray.at(1));
char output[].append(charArray.at(7));
char output[].append(charArray.at(3));
cout << output;
}
int main() {
testClass testObject;
testObject.testFunction("Flowers");
return 0;
}
}
What it's meant to do is:
- get the Letters 'F', 'S' and 'O' from the char array from an index number
- append that char to the output chararray
It's been frustrating since I've went from strings, to *chars, and char arrays.
Not really sure what the simpliest easiest solution is. Yes, I want to retain 1 char at a time from that string. It was just meant to be a fun project but it's way more complicated than I thought it'd be
expected output:
- FSO
Aucun commentaire:
Enregistrer un commentaire