Adding char to an array variable

Pages: 12
I do have one question, it still shows up as null, why is this? It wouldn't display the string of char which is what I'm trying to aim for.
If you want to input a string from the user and then output, you'd be much better off using proper C++ objects. This code allows the user to enter spaces as well.

1
2
3
4
5
6
7
8
9
10
#include<iostream>
#include<string>

int main()
{
  std::string s;
  std::getline(std::cin, s);
  std::cout << s;
  return 0;
}
Topic archived. No new replies allowed.
Pages: 12