How do I include spaces in my Char String

I am new to c++ programming and I'm writing a simple program in which the user inputs a sentence and the program reads the sentence back to you, but all I can get it to read back is the first word of the sentence. Dose anybody know how to fix this?



#include <iostream>
#include <string.h>
using namespace std;

int main() {
cout << "please enter a sentence. " << endl;
char String1[80];
cin >> String1;
cout << "you entered the sentence: " << endl;
cout << String1 << endl;
system ("pause");
}
1. What if the user types in more than 80 letters? Use std::string instead, in the <string> header.
2. http://www.cplusplus.com/reference/string/getline/
Topic archived. No new replies allowed.