Elemental_1_1's Profile User Rating: -----

Reputation: 1 Apprentice
Group:
Active Members
Active Posts:
114 (0.05 per day)
Joined:
22-January 09
Profile Views:
2,143
Last Active:
User is offline Jan 20 2014 09:00 PM
Currently:
Offline

Previous Fields

Country:
AU
OS Preference:
Linux
Favorite Browser:
FireFox
Favorite Processor:
AMD
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   Elemental_1_1 has not set their status

Posts I've Made

  1. In Topic: How to draw a simple Hangman in Java

    Posted 15 Oct 2013

    You'd use a Key Binding and figure out a way to rotate the hangman
  2. In Topic: how to make paint program not error out

    Posted 14 Oct 2013

    It's just you can't have a dynamically sized array; you need to use ArrayList, otherwise you will have an upper limit on the number of circles
  3. In Topic: how to make paint program not error out

    Posted 14 Oct 2013

    What about using ArrayList<Dimension> instead of two different arrays for x and y?
  4. In Topic: Would This Method Produce A Number In Between What I Want?

    Posted 13 Oct 2013

    Bottom range is inclusive top range is exclusive. 3524 <= random number < 8694
  5. In Topic: Invalid Cast

    Posted 10 Oct 2013

    Thanks, I can see what you've said is outlined in the documentation, I just didn't interpret it properly.

    EDIT: After doing some research, casting a char to an int isn't what I needed. I needed to convert a char to an int, and this is done by subtracting the char '0' from the desired char.

    EDIT2: Completed, working code if anyone was interested:

    #include <iostream>
    #include <fstream>
    
    using namespace std;
    
    int lps(ifstream& in)
    {
            char c;
            int i = 5;
            int nums[5] = {0,0,0,0,0};
            int max = 0;
    
            while(in.good())
            {
                    in.get(c);
                    nums[i%5] = c - '0';       
                    if(nums[0]*nums[1]*nums[2]*nums[3]*nums[4] > max) {
                            max = nums[0]*nums[1]*nums[2]*nums[3]*nums[4];
                    }
                    i++;
            }
    
            return max;
    }
    
    int main()
    {
            ifstream input;
            input.open("number");
            if (input.fail())
            {
                    cerr << "Failed to open file";
            }
            cout << lps(input) << endl;
            return 0;
    }
    
    

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Years Programming:
3
Programming Languages:
Current: Java
Have used: HTML, CSS, Javascript, PHP, MySQL, C++.

Contact Information

E-mail:
Private
Website URL:
Website URL  http://

Friends

Comments

Page 1 of 1
  1. Photo

    successfulangel Icon

    09 Jul 2011 - 23:46
    I want to be your friend and i want to learn Java writing style from you .As i am beginner and i need to practice a lot..Can i know your gmail.If you let me know...I wil be really happy for it..:)
Page 1 of 1