BTW I'm using Windows Vista and Visual C++ 2005.
Jared
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
#include <cstring>
using std::strtok;
const int SIZE = 80;
// function prototype
void printLatinWord( char const * const );
int main()
{
char sentence[ SIZE ];
char *tokenPtr;
cout << "Enter a sentence:\n";
cin.getline(sentence, SIZE);
tokenPtr = strtok(sentence, " ");
while (tokenPtr != NULL)
{
cout << tokenPtr << '\n';
tokenPtr = strtok(NULL, " ");
}
return 0;
}//End main function
/**
void printLatinWord(char const *tokenPtr)
{
String result;
if(tokenPtr.length() > 0)
result = tokenPtr.sub(1, tokenPtr.length() - 1) +tokenPtr[0] + "ay";
return result;
}//End printLatinWord function
**/

New Topic/Question
Reply




MultiQuote





|