Disclaimer: I have to use char arrays instead of strings because this is a part of my home assignment.
I try to input a string from a keyboard into a char array. However, it always inputs only the first word, independently of how I declare the array. Two examples of when I do this:
#include <iostream>
int main() {
char arr[] = "";
std::cin >> arr;
return 0;
}
and
#include <iostream>
int main() {
char* arr = new char[100];
std::cin >> arr;
return 0;
}
Both times I expect the string I enter to be stored in arr fully, but it stores only the first word: all the symbols before the first space.