Would anyone know how to put user input into a Char Array. I've provided the code below
It doesn't work so I've tried many variations like making char wrd as char wrd[20] but still nothing.
I think I'm missing a fundamental point here.
All I want to do is have a prompt which says please enter a word and then enter
three letters starting from the second character in char myarray[20]. I just want that arrary to receive
user input so I can manipulate the string later.
Any clues as to how to go about this? Thanks
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
char wrd;
cout << "Enter a word, any word \n";
cin >> char wrd;
// below is where I'm getting the problem. I know this is wrong
// but I just can't figure out how to fix it.
char myarray[20] = wrd;
cout << myarray[1] << "\n";
cout << myarray[2] << "\n";
cout << myarray[3] << "\n";
system("pause>nul");
}