// String program - How to enter a string and use the '\0' null string // character to check for the end of a string. #include #include main() { int i = 0; char string1[20]; cout << "Enter a string: "; // cin >> string1; cin.getline(string1, 20, '\n'); while (i < 20) { if (string1[i] == '\0') return(1); else { cout << string1[i] << " "; ++i; } } return(0); }