Skip to content
Snippets Groups Projects
Commit 24fbab55 authored by Hai Dang's avatar Hai Dang
Browse files

Updated Crossword

Ajout d'un compteur du nombre total d'occurence d'un mot. Task 3 fait.
parent 03bf060e
No related branches found
No related tags found
No related merge requests found
...@@ -147,6 +147,19 @@ public class Crossword { ...@@ -147,6 +147,19 @@ public class Crossword {
System.out.println(); System.out.println();
} }
public int countWord(String word){
this.WordCount = 0;
for (int j = 0; j < columns; ++j) {
for (int i = 0; i < rows; ++i) {
if (searchRow(j, i, word)) {
this.WordCount ++;
} else if (searchColumn(j, i, word)) {
this.WordCount ++;
}
}
}
return this.WordCount;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment