Advertisement
Guest User

Untitled

a guest
May 6th, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. //Jeffrey Liv
  2. //CPSC 131
  3. //Project 11 Part 1
  4.  
  5. #include <iostream>
  6. #include <string>
  7. #include <cstring>
  8. #define _CRT_SECURE_NO_WARNINGS
  9. #include <ctime>
  10.  
  11. using namespace std;
  12.  
  13. int main()
  14. {
  15.     time_t p;
  16.     time(&p);
  17.     cout << "Today's date and time " << endl << ctime(&p) << endl;
  18.     char option;
  19.    
  20.     do{
  21.        
  22.         char line[80];
  23.  
  24.         cout << "Enter a phrase: ";
  25.         cin.getline(line, 80, '\n');
  26.  
  27.         char *token;
  28.        
  29.  
  30.         cout << "   ";
  31.         token = strtok(line, ",;:?.");
  32.         while (token != NULL)
  33.         {
  34.             cout << token << " ";
  35.             token = strtok(NULL, ",;:?.");
  36.         }
  37.         cout << endl;
  38.  
  39.         cout << "CONTINUE(Y/N)? ";
  40.         cin >> option;
  41.         cin.ignore();
  42.     } while (option == 'Y' || option == 'y');
  43.  
  44.     return 0;
  45.    
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement