identifying words and sentances

Aug 23, 2012 at 4:51am
I am attempting to write a code that takes a few words or sentences typed into one array, and split it up so the computer knows what each is(ie word, word, word, word, period).

for some reason it wont show the word back after I attempt it. can anyone tell what is wrong just from a glance?

I am debugging and executing this in visual C++ 2010(not as good as blood dev but give me a break for now.)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <array>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

int i = 1;
char entry[160];
char wordO[15];
char wordTw[15];
char wordTh[15];
char wordFo[15];
char wordFi[15];
char wordSi[15];
char wordSe[15];
char wordE[15];
char wordN[15];

int main()
{
	cout<<">Hi"<<endl;

	do{
		cin>>entry;
		do{

			//words >RIGHT HERE
			do{
				int Copy = 0;
				wordO[Copy] = entry[Copy];
				Copy++;
			}while(entry[Copy] != ' ');
					for(int Speak = 0; Speak <= 15; Speak++)
					{
						cout<<wordO[Speak];
					}
                }while(entry[Copy] !='.'||entry[Copy] !='/0');//one sentence

	}while(i != 0); //loop for talking

	return 0;
}
Aug 23, 2012 at 7:19am
The reason is line 30. Copy is always reset to 0. It shouldn't even compile
Aug 23, 2012 at 8:53am
put
int Copy = 0
outside of the do-while loop.
Aug 23, 2012 at 2:55pm
thanks, that was the problem and why it was in the beginner thread.
Topic archived. No new replies allowed.