zeroliken 79 Nearly a Posting Virtuoso

i am having an error while executing this statment..

That said if you want us to look deeper into the problem you can post your code and describe what the error is

zeroliken 79 Nearly a Posting Virtuoso

“ It's not at all important to get it right the first time. It's vitally important to get it right the last time. ”
- Andrew Hunt and David Thomas

zeroliken 79 Nearly a Posting Virtuoso

simple way to check if a JButton is not Enabled

isEnabled() would return false if the button is not enabled and true if otherwise
Isn't that enough to know that the button is not enabled?

stultuske commented: why go easy if you can go the hard way ... thought this post would solve the thread, but hey :) +12
zeroliken 79 Nearly a Posting Virtuoso

Maybe this article on using a Toolkit method, getImage() might help you out
Link to Article

zeroliken 79 Nearly a Posting Virtuoso

I don't think there's really a the best browser
Lots of users have different opinions and taste as to what browser they would like to use often

Now why do you ask, are you just asking for our opinions?

Well I personally think Google chrome is great in terms of speed and popularity, plus it doesn't crash a lot, the same can be said for opera and maybe firefox

zeroliken 79 Nearly a Posting Virtuoso

Here's an guide and example on How to Write a key Listener from Oracle to give you more info about Key Listeners

zeroliken 79 Nearly a Posting Virtuoso

Learn to Love, Love to Learn

DJSAN10 commented: nice +0
zeroliken 79 Nearly a Posting Virtuoso

How did you install it?
Did you use Wubi(installed alongside windows)
or did you partition the hard drive
I think its a lot easier to remove if Ubuntu just runs with your current system

zeroliken 79 Nearly a Posting Virtuoso

There are lots of basic java examples and definitions of a term on the web if you try to search
If you have problems in understanding or couldn't figure out an error in your code then you can ask here for help

zeroliken 79 Nearly a Posting Virtuoso

Try to download a torrent.

Just make sure that what your downloading is not illegal :)

zeroliken 79 Nearly a Posting Virtuoso

I think that you should have posted this in the JSP forum

zeroliken 79 Nearly a Posting Virtuoso

Yep I can see the sponsor badge when i hover over your avatar so I'm positive that your payment got through

zeroliken 79 Nearly a Posting Virtuoso

But when you say the tail should move opposite of the head,

I'm sorry if I wasn't clear what I meant is the location of the tail should be opposite to the front of the head so when you press a key the circle head's front will change direction which will make the tail "attached" to it move in the direction opposite of the head circle's front side
ex.
moving to the right: tail->head->front
moving to the left: front<-head<-tail
moving to the upwards:
front
|
head
|
tail

Overall, the game looks like a bunch of circles moving at the same time.

That's what my suggestion is suppose to solve :)

zeroliken 79 Nearly a Posting Virtuoso

Could you post the current output of the program and then your desired output

zeroliken 79 Nearly a Posting Virtuoso

I think it would be better for the body to follow the snake head instead of only reacting to the key pressed by the user

The snake head should have a front like method where you'll know the front of the circle by knowing where the snake is headed
e.g. if the snake head is moving headed towards the right its front side is the circles right side

The tail that will be attached to the snake will have an almost same structure as the head but instead of reacting to the key pressed by the user it will move towards the current location of the head,the head should have a method that return the current head's location where the tail will move close to(distance between head to tail depends on the size of the circle) then the tail will react to the front of the head by moving to the opposite direction(the purpose of knowing the front of the snake)

After eating another fruit,the added tail will move to the last tail of the snake by moving according to the last location and will move around the circle it is attached to(all of the circles has a front where the last circle attached to it will move opposite to)

I hope you can visualize what I'm saying here, by following this suggestion there's going to be major changes in the coding but I think your gonna face the same problems with the body movement …

zeroliken 79 Nearly a Posting Virtuoso

# and determine if the number is divisible using the modulus operator.

modulus returns the remainder of a number
ex.

>>> 10%4
2
>>> 10%2
0

if the answer is 0 then the number is perfectly divisible
this should give you a hint if the number is prime

zeroliken 79 Nearly a Posting Virtuoso

In the midst of following the directions on the link Zero left. Guess I got ahead of myself & posted before reading the "read me".

I'd hope it's not hardware; I've only had the laptop since August 2010.

In case your gonna post the required scanlogs I think you should start a thread of your own
the OP might not be happy to find that someone else will receive help for the thread he created :)

zeroliken 79 Nearly a Posting Virtuoso

In that case how do you the loop to end?

zeroliken 79 Nearly a Posting Virtuoso

Do you want the program to continue to run after the else if statement?
You do realize that if the value of y becomes 0 it will exit the loop right?

zeroliken 79 Nearly a Posting Virtuoso

Exactly what part of the code are you having problems with?

zeroliken 79 Nearly a Posting Virtuoso
if (input > 0 || input > 8 || input.hasNextInt())

Like what stultuske said hasNextInt() can only be used in a scanner object
("in" in your code is a scanner object )
Also maybe you meant input < 8
But this method won't work for non numeric input

How about using regex like in this thread
Re: Input Check (Int or not)

zeroliken 79 Nearly a Posting Virtuoso

Yes there a link to "this" in his similar thread in the c++ forum
http://www.daniweb.com/software-development/cpp/threads/407748
@OP are trying to make the program in c or c++?

zeroliken 79 Nearly a Posting Virtuoso

Why would you want to create an animation with graphics.h which is a very old and deprecated library?

Anyway here's a thread with a similar problem that talks about how the flag should have a wave like motion
-->link to said thread

zeroliken 79 Nearly a Posting Virtuoso

Why is everybody helping a person who can't even ask a normal question?

There can various reason one can think of but I think its
Just because :)

zeroliken 79 Nearly a Posting Virtuoso

Duplicate post

You should have properly indented the code on the first thread and posted on same thread instead of creating a new one
(which by the way the formatting isn't any better than the first)

myrongainz commented: fuk you -1
dij_0983 commented: @OP don't be rude keep it pleasant +1
zeroliken 79 Nearly a Posting Virtuoso

Maybe the 2 of you might get more help if you follow the instructions from this read me thread and wait for someone to read all of the required scanlogs to get professional help
http://www.daniweb.com/hardware-and-software/microsoft-windows/viruses-spyware-and-other-nasties/threads/134865

zeroliken 79 Nearly a Posting Virtuoso

who told you that 121 is a prime number oh please
besides the code i have written works perfectly fine and i have tested it a hundred times

Please be reminded that the code you post should always be compatible with different (if not all) compilers
for example main should have a return type ..int to be exact

i can pretty easily guess that you are a noob at c++ as this code is made for dev c++ compiler which is popular nowadays

Keep it pleasant, don't be rude to other members, also I can say that he knows what he's talking about and is quite knowledgeable at c++ as i have seen his previous posts

zeroliken 79 Nearly a Posting Virtuoso

also there is no 'or' statement in java use the '||' as an or operator i.e

if (closest.name= "Weston-On-Shore" ||closest.name.equals("Newbridge" or "Central")) {}

you made an obvious error here... "Newbridge" or "Central" :icon_wink:

zeroliken 79 Nearly a Posting Virtuoso

Oh so you want to end the program if the input is invalid

You could make the rest of the code run only if a condition is met
ex.

int main(void){
int i,j, dontrun = 1;
for(i = 0;i<strlen(ref);i++){
    for(j = 0;j<strlen(input);j++){
        if(input[j] == ref[i]){
           printf("Invalid Input");
           dontrun = 0;
           break;
        }
    }
}
    if(dontrun == 1){
       //rest of the codes are here
    }
}
zeroliken 79 Nearly a Posting Virtuoso

Before using atoi() you can check each of the values in input is a letter
for example you can create a string containing alphabets as a reference like this:

char ref[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$"; // contains a to z and their corresponding capital letters as well as other unwanted input like other symbols

then you can compare this to your input string to know if it contains a letter

int i,j;
for(i = 0;i<strlen(ref);i++){
    for(j = 0;j<strlen(input);j++){
        if(input[j] == ref[i]){
           printf("Invalid Input");
           break;
        }
    }
}

Then put these in a loop that has a boolean like use, as long as the user input has a letter the program will not continue

P.S. strlen() is from the string.h library you can use numbers to reference the length of the string as a condition for the for loop if you like

zeroliken 79 Nearly a Posting Virtuoso

Do you or do you not want the user to enter an alphabet?
Do you want the letter to be converted to its ASCII value or some other value or tell the user that he shouldn't enter a letter

zeroliken 79 Nearly a Posting Virtuoso
#include<stdio.h>
#include<conio.h>
int main()
{
   int i,j,k,cnt=0;
   clrscr();

   for(i=5;i>=1;i--)
   {
    for(j=1;j<=i;j++)
    {
      printf("*");
    }
    for(k=i;k<5;k++)
    {
       printf("S");
    }
    for(k=i+1;k<5;k++)
    {
      printf("S");
    }
    if(cnt<2)
    {
    for(j=1;j<=4;j++)
    {
        printf("*");
    }
    cnt++;
    }
    else
    {
        for(j=1;j<=i;j++)
        {
            printf("*");
        }
    }
        printf("\n");
   }


   getch();
   return 0;
}

Did you read WaitP's post above you? It applies to your post as well :yawn:

zeroliken 79 Nearly a Posting Virtuoso

Hold on! I take that back - just a second. How's this?

Scanner input = new Scanner(System.in);
		roman = input.nextInt();						
		roman = roman.toUpperCase();
		roman = roman.trim();

I was gonna reply how to properly do it but it seems you got the gist of it :)
You can try it to see if it works for you

zeroliken 79 Nearly a Posting Virtuoso

i have to draw a vertical line onto a screen.

Are you trying to create a GUI?
If that's the case you can either use a Swing component for the draw capability like in a JPanel or
the draw function for Applets

zeroliken 79 Nearly a Posting Virtuoso

Here's an example

/*menu function*/
int menu(int *choice){
    //here are the codes for the menu
return choice;
}

/*main function*/
int main(void){
    int choice;
    menu(&choice);
    .
    .
    .
    return 0
}

note: there are a lot of ways to initialize a function
Try to read about how to use and create functions in c, there are tons of articles about that on the web

zeroliken 79 Nearly a Posting Virtuoso

Thank You very much for your help. I will try to carry on from here. Still, is such an concept all that useless? Got the idea, when one of my colleague (No touch with C++), ran my program and was quiet confused with the matrix. So just wanted to make it user-friendly.

Anyway Thanks again.

Yes it might be fun and user friendly but only for a while... It's not like your gonna use the program or use it as a basis for another program years for now
....then again who knows I could be wrong ;)

Instead you could also show the user the position they're inputting the number like e.g
"Enter number for row 1 column 1:"
To make it a bit more user friendly without going to all the trouble your doing right now

Just a suggestion :)

zeroliken 79 Nearly a Posting Virtuoso

Don't forget to include break; in your cases otherwise it will continue to run the statements case after case

zeroliken 79 Nearly a Posting Virtuoso

Your post is currently in the c forum
You should have started your thread at the C# forum

zeroliken 79 Nearly a Posting Virtuoso

You need to remember that an array holds values in its elements from 0 to size-1
in the case of random[50] the values of the numbers can be stored from random[0] to random[49]

for(counter; counter<50; counter++)//did not use counter as the array index
{
if(min>random[50]);//the 50th element is reserved for \0
min=random[50];

}

In your loops you did not try to access all the elements of the array

zeroliken 79 Nearly a Posting Virtuoso

now it works fine but my println prints out twice.

boolean read = false;
		while(!read){
			System.out.println("What is your desired border character (only the first character will be printed)?");
			String run = sc.nextLine();
			if(run.length() != 0){
					draw(run.charAt(0));
					read = true;

If that's the whole loop your missing 2 end brackets one for the if statement and one for the whole while loop

zeroliken 79 Nearly a Posting Virtuoso

now it works fine but my println prints out twice.

boolean read = false;
		while(!read){
			System.out.println("What is your desired border character (only the first character will be printed)?");
			String run = sc.nextLine();
			if(run.length() != 0){
					draw(run.charAt(0));
					read = true;

By "prints out twice" do you mean that after the inputting, it loops again showing again the println?

Can you post the whole while loop

zeroliken 79 Nearly a Posting Virtuoso

Don't use gets()
-->Article explaining why not
Try to use fgets() instead

PrimePackster commented: Thanks.... +3
zeroliken 79 Nearly a Posting Virtuoso

public void addListener (Connect2listener)

It has no identifier

zeroliken 79 Nearly a Posting Virtuoso

Did you check the API?

zeroliken 79 Nearly a Posting Virtuoso

Here's a suggestion
Why not use a modern compiler instead of carrying the burden of an old compiler?

zeroliken 79 Nearly a Posting Virtuoso

And why would you want to create a virus?

zeroliken 79 Nearly a Posting Virtuoso

@OP
Then how can you check if the values of max1, max2 to max3 at the loop is satisfactory and know where the problem in assigning might lay considering that the function is returning garbage values?
You did not even post the values your trying to pass to getTopThree() so its more on guesswork on our side

I'm just trying to help here :(

mKorbel commented: good comment +11
zeroliken 79 Nearly a Posting Virtuoso

use println statements to check the values of max1 to 3 at the loop

jot121 commented: bad comment -1
zeroliken 79 Nearly a Posting Virtuoso

Why do you need to convert the integer array to a string array?
can't you use an if statement for the original array already

zeroliken 79 Nearly a Posting Virtuoso

data from a user as a string of number or letters and store each char on a different array

a loop that will copy the current value of the array depending on its index to another array with the same index