fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cstring>
  4. using namespace std;
  5. int main()
  6. {
  7. char message[80];
  8. cout << "\n what is your message today?" << endl;
  9.  
  10. cin.getline(message, 80); // Enter a line with a max of 79 characters.
  11. if (strlen(message) > 0) // If string length is longer than 0.
  12. {
  13.  
  14. for (int i = 0; message[i] != '\0'; ++i)
  15. cout << message[i] << ' ';
  16. cout << endl;
  17.  
  18. }
  19. }
Success #stdin #stdout 0s 4520KB
stdin
Hello, world!
stdout
 what is your message today?
H e l l o ,   w o r l d !