I am a newbie in C++....I am trying to modify program to read in upto four words or 30 characters into a string and then print it out.

Here is the code.....

#include <iostream>
#include <conio.h>
using namespace std;
int main()
	bool isWord = false;  
	char ch;
	int wordCount = 0;  
	do {
		ch = getche(); 
		if (ch == ' ' || ch == '\r') {  
			if (isWord) {    
			isWord = false;  
		else if (!isWord)  
		isWord = true;  
}		while (ch != '\r');  
	cout << "\nNumber of words typed: " << wordCount << endl;

Please advice!

Why use getche? As well as being compiler-specific, it is not very c++-like to use such functions. Here is some info on how C++ does i/o.