zeroliken 79 Nearly a Posting Virtuoso

you could also add a MouseListener to every component where an image is shown (maybe a JPanel or JButton) and whenever they are pressed set the background image to the frame depending on which image is clicked

zeroliken 79 Nearly a Posting Virtuoso

using c++ libraries is a norm but if you would really insist on the code then here's my help...

I tried it myself and got it to work without experiencing garbage values so here's my advice for your problem

  1. make sure that both files can be found at the same directory as the cpp file
  2. make sure that the value inside the "New Text Document.txt" is an integer
  3. conio.h is a deprecated library, it doesn't work for most compilers so I removed it in mine along with getch
  4. always use int main and have a return 0 for a succesful execution of the program
  5. if your still getting a garbage output try to set the value of int x to 0

note: tested the following program with linux's built in g++ compiler

if your still getting a garbage value then could you post what's inside those text file

zeroliken 79 Nearly a Posting Virtuoso

oh, right sorry didn't notice

zeroliken 79 Nearly a Posting Virtuoso

the constructor and methods should look a little like this

public class find {
    int[] array;

    public find(int[] array){
    }

    public int findmax(){
    ...
    return max; 
    }

    public int findmin(){
    ...
    return min;
    }
}
zeroliken 79 Nearly a Posting Virtuoso

Do you already know how file i/o works?
if not you can start at these java docs
http://docs.oracle.com/javase/tutorial/essential/io/

zeroliken 79 Nearly a Posting Virtuoso

@ line 6
your assigning a value to the null terminator of the matrix

i want the elemnets of every matrix is random number using time function

instead you should make a nested loop that traverses it's indexes and inside that loop it assigns a random value for the current index

Ancient Dragon commented: right :) +0
zeroliken 79 Nearly a Posting Virtuoso
zeroliken 79 Nearly a Posting Virtuoso

I completely agree with using fgets() over scanf()

sigh... I'm bored and there's a lack of new articles for me to post so here's a workaround for scanf that uses character classes

int main(void)
{
    char string[100];
    scanf("%[a-zA-Z0-9+-*/=%.,?!:; ]s", string);
    printf("%s\n", string);
return 0;
}

NOTE: It won't be as effective as fgets though ;)

zeroliken 79 Nearly a Posting Virtuoso

it's gonna be hard to tell which part of the code shows where the multiplication has gone awry
could you post the current output and then post what it should look like

zeroliken 79 Nearly a Posting Virtuoso

you can't create a method inside main instead you should create an instance of the public class in the main method then call the class' method

zeroliken 79 Nearly a Posting Virtuoso

could you post your current code now with main

zeroliken 79 Nearly a Posting Virtuoso

you can only return a value similar to the function's data type
instead of returning a boolean value you could pass by reference the boolean variable to change it's value accordingly

zeroliken 79 Nearly a Posting Virtuoso

i am really not sue how to add in the .56 probablity thing

here's one way:
considering that you know how to use rand()
you could randomize a value from 0 to 99 and if it lands between 0-55 player ada wins else if it's 56 - 99 the other player wins

Eagletalon commented: agree with the function suggested 100% +0
zeroliken 79 Nearly a Posting Virtuoso

maybe you need to try to close the file to save what you wrote

zeroliken 79 Nearly a Posting Virtuoso
zeroliken 79 Nearly a Posting Virtuoso

is it an issue that some newbie members start with their 'Community Reputation Points Awarded' as 0?

zeroliken 79 Nearly a Posting Virtuoso
zeroliken 79 Nearly a Posting Virtuoso

ah sorry I mean the Community Reputation Points Awarded, didn't it started out as 10?

zeroliken 79 Nearly a Posting Virtuoso

Do new members start now with 0 rep points?

zeroliken 79 Nearly a Posting Virtuoso

other than that you could use an overlayLayout
1) create a JPanel and set its layout to OverlayLayout
2) create a new JPanel and add the image to this then add this JPanel to the JPanel created in 1
3) create another JPanel and add your buttons here then add this JPanel to the JPanel created in 1
4) add the JPanel created in 1 to the JFrame.

zeroliken 79 Nearly a Posting Virtuoso

you need to decide wether to use file i/o in C or C++
for C++ read this: http://www.cplusplus.com/doc/tutorial/files/
for C read this: http://www.cprogramming.com/tutorial/cfileio.html

dij_0983 commented: helpful links +1
zeroliken 79 Nearly a Posting Virtuoso

where exactly did you put those variables?...
if it's in the struct printing it (after populating it with data) is something like
printf("%d %s %s\n", a[i].nTransistors, a[i].ManID, a[i].Polarity);
where i is the current index of a loop if your using an array of struct

zeroliken 79 Nearly a Posting Virtuoso

create a constructor in the Goldfish and Dog class that takes a string

maybe reading these will help you out
http://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html
http://www.javaworld.com/javaworld/jw-10-2000/jw-1013-constructors.html

zeroliken 79 Nearly a Posting Virtuoso

as I understand mike_2000_17 suggestion

'previous' is not a variable but a pointer to a node
and it would point to the variable before the nodes to be swapped
so when traversing the linkedlist when the next node would be part of the node to be swapped after that, you assign the current node to 'previous'

now that I think about it, it's exactly the one I had in my mind which is no surprise since it's the common solution :)

zeroliken 79 Nearly a Posting Virtuoso
To create a new node

allocate memory for the new node

 new_node = (struct node *) malloc( sizeof(struct node) );

next save data for content

     scanf("%d" , &new_node->data);
To insert
struct node *temp = NULL;   //temporary pointer will be used instead of head, head will be a reference for the whole linked list
temp = head;
if(head == NULL){
    head = new_node;     
}
else{
    while(temp->next != NULL){ //until the end of list is not found
        temp = temp->next;
    }
    temp->next = new_node;
}
zeroliken 79 Nearly a Posting Virtuoso

When I use the suggested code to print the inout data, it tells me that "int Transistors" was not initialized. This means that it wasnt declared in the "int main()"?

are you using exactly the code posted by AD cause there's no variable Transistors found there

Ancient Dragon, I am using the code exactly as you have written it 5 posts up from this one. That is what I am running. So what Id like to do is now before the program terminates is to print all the data inputted by the user on the screen. How do I printf a struct?

almost the same way as you used scanf on the contents, use a loop to traverse and print the elements of the struct array

zeroliken 79 Nearly a Posting Virtuoso

is the starting java read me thread suppose to show in the whole software development forum and not just inside the java forum?

zeroliken 79 Nearly a Posting Virtuoso

try to read while it's not the end of file... something like this

while (1)
{
    fscanf(ca, "%s %s %s", userc, pass ,v);
         if ( feof(ca) ) 
          break;
    printf("%s, %s, %s\n", userc, pass, v);
}
zeroliken 79 Nearly a Posting Virtuoso

I tried the program and I got it to work... are you sure that the text file is in the same directory as the c file?

zeroliken 79 Nearly a Posting Virtuoso

save it to the address of c make that:

 scanf("%c",&c);
zeroliken 79 Nearly a Posting Virtuoso

include stdio.h
include string.h

first And foremost it's

    #include <stdio.h>
    #include <string.h>

then...just noticed something

int loop=0;

if loop is initially 0 it would never pass the while loop in the first place

also is that the whole code? don't forget to close the file after opening

zeroliken 79 Nearly a Posting Virtuoso

ca=fopen("CA_users.txt", "w");

when you use "w" for writing your erasing the previous contents of the file
that should be set to "r for reading only or "r+" for reading and writing without erasing

zeroliken 79 Nearly a Posting Virtuoso

I believe there's already a builtin getline function in stdio.h
try to rename the function and all instance that uses the same name

zeroliken 79 Nearly a Posting Virtuoso

could you post your code so we may see what you did

zeroliken 79 Nearly a Posting Virtuoso

if you mean you need help concerning a virus or something similar?

then yes if either crunchie or PhilliePhan or anyone else who can read logs from MalwareBytes is available today

zeroliken 79 Nearly a Posting Virtuoso
Scanner console = new Scanner(System.in);

include this in the main method and remove static

zeroliken 79 Nearly a Posting Virtuoso

traverse the array using a loop
when a character x is found convert the digit before the x using atoi() then save it temporarily to a variable then check the operation after the "x" after that check the next elements for the x and do the same

for example:
2x+3x
traverse the loop
when an x is found
convert and save 2 (the element before x)
check the operation (+) (make a condition for all operations)
check the set after the operator
check if the there is another x
convert and save 3
solve the current operation (3+2) and save the answer
continue traversing the array until the end of the array is found

anything else you need to be aware of are digits that doesn't have an x with them or x that is not preceded by a digit so the default should be 1 and finally negative numbers

note: I once did a similar program like this with algebraic equations but I used linked lists instead of arrays so I can have a better control of the elements but I believe the concept should be about similar...also coding this would be longer than the code you posted so good luck :)

zeroliken 79 Nearly a Posting Virtuoso
  1. If the node to be swapped is found on the head
    a. create a temporary pointer and make it point to the node after head
    b. make the next pointer of the head node point to the next node of the node after head
    c. make the next pointer of the node pointed by the temp pointer point to the head node
    d. make the head pointer point to the temp pointer

  2. If the node to be swapped is found in the middle
    a. same procedure with when swapping the head node but instead you'll use the temporary pointer when traversing the linked list in swapping the nodes

zeroliken 79 Nearly a Posting Virtuoso

Will there still be HTML code snippets of our Daniweb member badges where we can copy and include it in our websites?

zeroliken 79 Nearly a Posting Virtuoso

Wrong, at least, not right now. Editing of posts does not work (no button appears for it, unless it's now somewhere else that I can't find), and it's not a time matter, in one of my last posts I tried to edit less than a minute after, and there was not way to do so.

Actually it appears right next to the Flag Bad post Button at the top right of your post near the upvote/downvote counter

EDIT: just refresh the page and it would appear

zeroliken 79 Nearly a Posting Virtuoso

did you enable your java plug-in in your browser?

I tried the program in HTML and got it to work...

zeroliken 79 Nearly a Posting Virtuoso

it's cough almost as good as Google ;)

zeroliken 79 Nearly a Posting Virtuoso

make a method that calls itself by incrementing or decrementing the value passed to it

will you be using threads here for the repaint?

zeroliken 79 Nearly a Posting Virtuoso

and after would be collision detection with the platforms when it detects the position of a platform it should stop the downward motion

a good example for this is a mario game
though deprecated here's a good example/tutorial I used as a base for my game a long time ago
http://www.javacooperation.gmxhome.de/PlatformGameBasicsEng.html

zeroliken 79 Nearly a Posting Virtuoso

In order to display it like this:

printf("this is right");

you need to type it similar to this

printf("this is right");

as for the problem when you detect that the input is an operator exclude it from being passed from the linked list, this could be solved by using if else statements

zeroliken 79 Nearly a Posting Virtuoso

You've been here for a long time already yet you still didn't put the code between

tags
the reasons WHY you should do this is that it preserves the indentation for easier reading and puts lines of code that help us point out a particular line to comment on

Did you compile the code??
>> if(strcmpi(str,"+")==0)
you have a syntax error here

now for your problem

every time i enter the OPERATOR (+) it will add and that operator display as '0' im having trouble in that operator i need to display it as blank >_< help me guys

display a space using printf(" "); instead of 0...
Though I think you did not ask what you intended to ask here
post what you need in detail here by showing us the desired output or maybe the statement/s involved here
be very detailed when you ask a question

also read the following articles from the links:
Things to avoid in C/C++
gets()
fflush(stdin)
system("pause")

dij_0983 commented: right +0
zeroliken 79 Nearly a Posting Virtuoso

weird I tried the whole code myself with the corrections I mentioned and got the 15 with all the correct answers...

I think you should try what Adak suggested :)

zeroliken 79 Nearly a Posting Virtuoso

@line 14 y1 is not yet initialized so y2 won't have a value

@ the while loops
the value of y1 or y2 doesn't change so there won't be a chance to exit the loops

Doing that, and matching up the braces (my editor does that nicely)

@rubberman
you mean when you copied the code to your editor then it indented it properly.
is it automatic, push of a button, or did you do it manually?

what editor are you using, I'm curious :)

zeroliken 79 Nearly a Posting Virtuoso

This can easily be answered with a wee bit of google search
and the first result answered the question precisely
http://www.cplusplus.com/doc/tutorial/functions/

zeroliken 79 Nearly a Posting Virtuoso

The problem isn't the first letter of the string
your comparing the null terminator of both strings which is equal

@line 6 remove the +1 from strlen
@line 13 change the condition to count<length (compare only the last letter value)