this program should read in strings from a file (cannot be opened in the program) until eof, determine if string that was just read in already exists, and if not, prints it out and saves it in the array of strings.

I can get it to input a single string ie. "test data", and it breaks it up into single letters. It would print, t e s t d a. Ofcourse with end lines where there are spaces. So its testing if the single character exist but I need it to test for the whole string.

ive messes around with cin.getline and some other things but couldnt get then to work. Is there a better way to input the strings from the file until eof? other than the way Im trying?

thanks in advance!




Code:
#include <iostream>
using namespace std;
#include <iomanip>
using std::setw;

const int strng_sz = 20;

main()
{
char Array[50][strng_sz];	// Array to hold the numbers w/o duplicates
char newChar[strng_sz];
int n = 0;	             	// The number of distinct numbers read so far
int j;	                  	// Index for inner loop

while (cin >> newChar[strng_sz])	// Loop to read input
{
   Array[n][strng_sz] = newChar[strng_sz];		// Store it as a sentinel at the end
                  		                     	// of the array.
   for (j = 0; Array[j][strng_sz] != newChar[strng_sz]; j++);       // Note empty body of loop

   if (j==n)			// Condition for newNum NOT to be a duplicate
   {
     cout << newChar[strng_sz] << endl;
     n++;		       	// Add newNum permanently to the array
   }
}
return 0;
}