a problem for printing my array

hi every body,
i need some help please i don't know why i cannot print my elements in my arrays.
i don't know why?
i have a struct Word whith 2 element one is a string and the other is integer.
i m read my data with void readData (), at the same times i m storing them into a array but i m having a problem to print my wordsarray.i know that i m missing some thing please some help to see this a bit more clear

here is the code :
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
44
45
46
47
48
49
#include<iostream>
#include<string>
#include<iomanip>

using namespace std;

struct Word
{
    string words;
    int amounts;
};

void readData(Word wordsarray[], int& size);

int main () {
    int max = 100;
    int size = 0;
    Word wordsarray [max];
  
        int j= 0;
        while(j > max)
        {
            cout<< wordsarray[j].words<< endl;
            ++j;
        }
    readData( wordsarray,size );  
    
}
  
void readData(Word wordsarray[], int& size)
{
    Word temp;
    cout << "enter a word"<< endl;
    
    while(temp.words != "#")
    {
        cin >> temp.words;
        
        if(wordsarray[size].words.find(temp.words))// check if there is the given 
                                                  //word in the arrau
        {
             ++wordsarray[size].amounts;
            
        }  
        wordsarray[size]= temp;// if there is not we stored the given word 
        ++size;
    }
     
}

please some help
sorry to distrub you guys i find the probleme it was my compare in thw while loop, line 21 it should be like this:

while(j <max)
Last edited on
Topic archived. No new replies allowed.