xXJigsaw23Xx

xXJigsaw23Xx

User name
xXJigsaw23Xx
Assigned title
IS what she said.
Assigned post color
#ddffbb
Avatar
Medals
THISISAMEDAL THISISAMEDAL
Registration date
2007 October 21
Post count
912
Score
41 ₧
Location
Above and Beyond as was the illuminati way.
Signature
But even then, I had my honor. The largest Banora White tree grew on a wealthy man's estate. It was rumored, that those apples tasted the best, but I never stole from that tree, because the wealthy man's son, was my friend...
Timezone
US/Pacific
Groups
havokk

Recent posts by xXJigsaw23Xx

Recent posts by xXJigsaw23Xx

2015 Sep 29 at 23:41 UTC
I saw this post and went to amazon with full intentions of buying a Wii U and Mario Maker. Instead in 5 days, I'll be receiving my 3DS.
2015 Sep 23 at 06:38 UTC
I'm bumping old trucks tonight, but I totally just have to say this. I've always wondered how many people always believed us to be the same person..
2015 Sep 23 at 06:34 UTC
This trucks name had the hidden message in it. Not of the upcoming forums, but of the day the anon Jigsaw decided to become a part of the system.
2015 Sep 22 at 04:34 UTC
Opinions on how to go about this issue?? in if( while ) switch{ coding } ++
Actually it's not like I couldn't just let you see. I'm just being a lazy fuck.
I'm trying to mix up the code at this point and just test it some.


code

#include <iostream>
#include <string>
#include <fstream>
#include <algorithm>
#include <stdio.h>
#include <string.h>

using namespace std;
const int LENGTH=30;

void removePunct(string & str);

int searchDictionary(string dict[], string word, int start, int end)

{


if(end<start)

{ return -1; } //not found

int mid=(start+end)/2;

if(dict[mid]==word)

{ return mid; } //found

else if(dict[mid] < word)

return searchDictionary(dict, word,mid+1, end);

else

return searchDictionary(dict,word,start,mid-1);

}

int BinarySearch (char ary[][LENGTH], int size, char search_item[LENGTH]){

const int LENGTH=30;
int first = 0, last = size-1;
bool found = false;
int position = -1, middle;

while (!found && first <= last){
middle = (first + last) / 2;
if ((strcmp (ary[middle], search_item))==0){
position = middle;
found = true;
}
else if (ary[middle] < search_item)
first = middle+1;
else last = middle-1;
}
return position;

}

int main() {

const int DICT_SIZE=3000; //size of dictionary

ifstream dictIn; //dictionary file stream
ifstream docIn; //document file stream
string wordList [DICT_SIZE]; //wordlist dictionary file to be loaded
string dictionaryName ="american-english.txt";//name of dictionary
int j=0, l=0, w=0, pos;
char c;

string word = "";
string tempWord = "";

dictIn.open(dictionaryName.c_str()); //load dictionary
int howMany=0; //count length of dictionary

dictIn>> wordList [howMany];

while(dictIn) //read successful

{

howMany++; //count

dictIn>> wordList [howMany]; //read dictionary

}
char templist = wordList[howMany];

docIn.open("document.txt"); //open document

for (l=0; !docIn.eof(); l++){ //test letters and reduce to lowercase
docIn >> word;
for (int a=0; word[a]!=0; a++){
while (word[a]){

c=word[a];
word[a]= (tolower(c));
a++;
}
}

pos=BinarySearch(templist, j, word);
if (pos==-1){
cout << word << " misspelled!!" << endl;
}

}
docIn.close();


return 0;


tempWord = word;

int search = searchDictionary(wordList, word, 0, howMany);
if (search != -1)
cout << "The word " << word << " is spelled incorrectly." << endl;


bool finished = 0;
bool wordFound = 0;
int length = word.length();
int n = 0;
int e = 0;
string userInput = word;


while(search == -1 && e < length && !finished)
{
e++;
n = e - 1;
swap(word[n],word[e]);
search = searchDictionary(wordList, word, 0, howMany);
if (search != -1){
cout << "Did you mean " << word << "? (enter 0 for no, 1 for yes)" << endl;
cin >> wordFound;
if (wordFound)
{
finished = 1;
cout << "The word was " << word << "." << endl;
}
}

search = -1;
word = userInput;
n++;
if (e >= length){
cout << "The word " << word << " is spelled incorrectly." << endl;
finished;
}
}
}



/*Function to remove punctuation from string*/
void removePunct(string & str)
{
str.erase(remove_if(str.begin(), str.end(), static_cast<int(*)(int)>(&ispunct)),str.end());
}
2015 Sep 22 at 04:32 UTC
Opinions on how to go about this issue?? in if( while ) switch{ coding } ++
So I'll probably post the finished product of this later. but actually there is a good portion of the stuff I posted that ended up like you've said being irrelevant to it. I've changed it a bit.
2015 Sep 22 at 04:27 UTC
The Quiet Truck in General
phoenix_r said:

2015 Sep 21 at 05:16 UTC
Opinions on how to go about this issue?? in if( while ) switch{ coding } ++
Also, an update on this. Although that was my original code. This is the code that I had planned to work with to deal with punctuation issues.

C++ code

#include <bits/stdc++.h>
using namespace std;

map <string,int> my_map;

bool check(string s){

if (my_map.find(s) == my_map.end())
return true;
return false;
}

int main(){

string ch = ".,:;()'-=+/*[]{}<>?!&|_";
ifstream infile;
infile.open("document.txt");
char c;
string temp = "";

cout << "The output of the spelling checker is a sorted list of misspelled words (all lower case), one word per line. " << endl << endl;

while (infile.get(c)){

if (ch.contains(c) == true || c-37 == 0 || c-47 == 0){

if (check(temp) == false)

cout << temp << endl;

temp = "";

}
else
temp += c;
}
return 0;
}
2015 Sep 21 at 04:44 UTC
Opinions on how to go about this issue?? in if( while ) switch{ coding } ++
Here is my code I used for the original project. It reads the user input and checks it against a document dictionary for errors and outputs if the word was spelled correctly or if the user meant another word. I need to change this up to read a document and pick out misspelled words out of it. The output would be a list of all the misspelled words in the document.

C++ code

#include <iostream>
#include <string>
#include <fstream>
#include <algorithm>
using namespace std;

const int DICT_SIZE=3000; //size of dictionary

ifstream dictIn; //dictionary file stream
string wordList [DICT_SIZE]; //wordlist dictionary file to be loaded
string dictionaryName ="american-english.txt";//name of dictionary

//dictionary file stores word in alphabetical order

int searchDictionary(string dict[], string word, int start, int end)

{


if(end<start)

{ return -1; } //not found

int mid=(start+end)/2;

if(dict[mid]==word)

{ return mid; } //found

else if(dict[mid] < word)

return searchDictionary(dict, word,mid+1, end);

else

return searchDictionary(dict,word,start,mid-1);

}



int main() {

string word = "";
string tempWord = "";

dictIn.open(dictionaryName.c_str()); //load dictionary
int howMany=0; //count length of dictionary

dictIn>> wordList [howMany];

while(dictIn) //read successful

{

howMany++; //count

dictIn>> wordList [howMany]; //read dictionary

}

cout << "Please enter a word to search for: ";
cin >> word;
tempWord = word;

int search = searchDictionary(wordList, word, 0, howMany);
if (search != -1)
cout << "The word " << word << " is spelled incorrectly." << endl;


bool finished = 0;
bool wordFound = 0;
int length = word.length();
int n = 0;
int e = 0;
string userInput = word;


while(search == -1 && e < length && !finished)
{
e++;
n = e - 1;
swap(word[n],word[e]);
search = searchDictionary(wordList, word, 0, howMany);
if (search != -1){
cout << "Did you mean " << word << "? (enter 0 for no, 1 for yes)" << endl;
cin >> wordFound;
if (wordFound)
{
finished = 1;
cout << "The word was " << word << "." << endl;
}
}

search = -1;
word = userInput;
n++;
if (e >= length){
cout << "The word " << word << " is spelled incorrectly." << endl;
finished;
}
}
}
2015 Aug 30 at 01:05 UTC
Oh, I could easily summon him here.
2015 Aug 26 at 05:25 UTC
C Puzzle #2! "-1--2--3--4--5--6--7--8-" in if( while ) switch{ coding } ++
I'm not actually convinced that any programmer is actually sure of what it is that they are doing.