WickedBetrayal's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Active Members
Active Posts:
84 (0.07 per day)
Joined:
16-February 11
Profile Views:
2,784
Last Active:
User is offline Feb 10 2013 03:22 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
XBox
Your Car:
Who Cares
Dream Kudos:
0
Icon   WickedBetrayal has not set their status

Posts I've Made

  1. In Topic: I return type Comparable, but java says I did not.

    Posted 10 Feb 2013

    Yes, I remember that now from a previous class. Is that what would get rid of all my warnings saying:

    Warning: java.lang.Comparable is a raw type. References to generic type java.lang.Comparable<T> should be parameterized
    
    


    ?
  2. In Topic: I return type Comparable, but java says I did not.

    Posted 10 Feb 2013

    View Postg00se, on 10 February 2013 - 02:04 PM, said:

    You have no default return. You could make return null the last line


    Thank you, thank you, thank you. You are far too kind.

    Quick side question: Median of 3 quicksort does mean find the median of the left/lo value, middle value, and far right/hi value, correct?
  3. In Topic: Exclude Everything But Letters In Fstream Input (Using >>)

    Posted 4 Sep 2012

    I fixed it by using erase(position,number of elements to erase).

    But I guess when it is done erasing, it messes up the size and I keep getting the out of range string error. Ah.
  4. In Topic: Exclude Everything But Letters In Fstream Input (Using >>)

    Posted 4 Sep 2012

    View Postvividexstance, on 04 September 2012 - 01:31 PM, said:

    How about writing your own input function? Have the function return a bool that is true if it was able to input a word and false otherwise. The function could input just a character at a time and you just check if the character is alphabetical. This way you could use the code that you had before, you just change the input stream operation with a call to the function you wrote.

    *EDIT*: I'm just curious as to where you increment the word frequency if you read in a word that's already been read in?


    Sorry. Here is the rest of inputting if the word already has been stored:

    for (unsigned int i=0;i<myVector.size();i++)
    	{
    		for (unsigned int j=i+1;j<myVector.size();)/>
    		{
    			if (myVector[i].word == myVector[j].word)
    			{
    				myVector.at(i).frequency++;
    				myVector.erase(myVector.begin()+j);
    			}
    			else
    				j++;
    		}
    	}
    
    
  5. In Topic: Exclude Everything But Letters In Fstream Input (Using >>)

    Posted 4 Sep 2012

    I got this.

     char alphabet[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
    
    
    	string word;
    	int frequency;
    
    	while (dataFile >> word)
    	{
    		for (unsigned int i=0;i<word.length(); i++)
    		{
    			for (unsigned int j=0;j<25;j++)
    			{
    				if (word[i] != alphabet[j])
    				{
    					word.erase(i);
    				}
    			}
    		}
    		frequency=1;
    		myVector.push_back(WordFrequency(1,word));
    		if (dataFile.fail())
    			break;
    	}
    
    


    It should work, but I get an xstring: string subscript out of range error when I compile around the line:
    if (word[i] != alphabet[j])
    

My Information

Member Title:
D.I.C Head
Age:
22 years old
Birthday:
May 28, 1992
Gender:
Location:
Pittsburgh, PA
Interests:
Computers, Astronomy, Photography, Metalcore music.
Full Name:
James Block
Years Programming:
1
Programming Languages:
Java, Assembly

Contact Information

E-mail:
Private
Facebook:
http://www.facebook.com/profile.php?id=677698277

Friends

Comments

Page 1 of 1
  1. Photo

    D.Mulroy Icon

    25 Apr 2011 - 19:13
    Mansfield University, what about you?
  2. Photo

    D.Mulroy Icon

    25 Apr 2011 - 19:00
    Reppin' PA xD
Page 1 of 1