Results 1 to 7 of 7

Thread: Find element in table

  1. #1
    Join Date
    Mar 2010
    Posts
    184

    Find element in table

    Hello,
    I would like to add a feature to my code, the possibility of seeking an element present in the table
    Here is my code:
    Code:
    publicclass Tab (
    publicstaticvoid main (String [] args) (
    int notes;
    System.out. System.out.println ("How many notes for one and two tables")
    notes = Read.x();
    
    int[] = NoteANewint[notes];
    int[] = NoteBNewint[notes];
    int[] = NotecNewint[notes];
    
    for(int x = 0; x <noteA.lengthI + +) (
    System.out. System.out.println ("Table 1 - Enter the footnote"+ (x +1) +":")
    noteA [x] = Read.x();}
    
    for(int x = 0; x <noteB.lengthI + +) (
    System.out. System.out.println ("Table 2 - Enter the footnote"+ (x +1) +":")
    noteB [x] = Read.x();
    }
    
    
    for(int x = 0; x <noteA.lengthI + +) (
    Notec [x] = noteA [x] + noteB [x];
    )
    
    
    for(int x = 0; x <noteA.lengthI + +) (
    System.out. System.out.println ("The values of the table are"+ Notec [x]);
    )
    System.out. System.out.println ("Please enter something to search");
    
    int note;
    = See note.x()
    ) [/ LEFT]
    )
    www.techarena.in

  2. #2
    Join Date
    Nov 2009
    Posts
    335

    Re: Find element in table

    Hello,
    Here are few questions for you
    1) What picture? Your code contains several

    2) The code in question is relatively clear, what do you want to search precisely A note? if so in what picture?

    3) Find a minimum yourself before posting your question. It will help if you encounter difficulties, but if you ask a ready solution without having sought

    Please reply back, so that this information will help use sort the problem.

  3. #3
    Join Date
    Nov 2009
    Posts
    343

    Re: Find element in table

    Hello,
    I have modified your code, please check if this helps you. Take a look at the modified version of the code
    Code:
    publicclass Tab (
    publicstaticvoid main (String [] args) (
    int nts;
    System.out. System.out.println ("How many notes for one and two tables")
    nts = Read.x();
    
    int[] = NoteANewint[nts];
    int[] = NoteBNewint[nts];
    int[] = NotecNewint[nts];
    
    for(int x = 0; x <noteA.lengthI + +) (
    System.out. System.out.println ("Table 1 - Enter the footnote"+ (x +1) +":")
    noteA [x] = Read.x();}
    
    for(int x = 0; x <noteB.lengthI + +) (
    System.out. System.out.println ("Table 2 - Enter the footnote"+ (x +1) +":")
    noteB [x] = Read.x();
    }
    
    
    for(int x = 0; x <noteA.lengthI + +) (
    Notec [x] = noteA [x] + noteB [x];
    )
    
    
    for(int x = 0; x <noteA.lengthI + +) (
    System.out. System.out.println ("The values of the table are"+ Notec [x]);
    )
    System.out. System.out.println ("Please enter something to search");
    
    int note;
    = See note.x();
    
    for(int x = 0; x <noteA.length-1 x + +) (
    System.out. System.out.println ("The value sought"+ Notec [x]);
    )
    )
    )

  4. #4
    Join Date
    Nov 2009
    Posts
    335

    Re: Find element in table

    Hello,
    I gather that the code should be close to that? How to indicate the position in the table?
    Here is the code I am talking about.
    Code:
    for(int x =0; NoteA[x]== v x = tab.length-1)
    {
    System.out.println("Value"+ + v"Sought is in the table
    the position+ Position);
    }
    Just try this, also, if you have a solution for this then please let me know.

  5. #5
    Join Date
    Nov 2009
    Posts
    446

    Re: Find element in table

    Hello,
    I think this can help you
    Code:
    for (int i = 0I <noteA.lengthI + + ) {
        if (noteA[i] Val ==) {
            System.out.println("Value"+ + Val"Sought is in the table at the position + I);
        }
    }
    I have modified this and if this works with you well and good. If not then post back with the error.

  6. #6
    Join Date
    Mar 2010
    Posts
    5

    Re: Find element in table

    ineed some one ... I want one to explain to me..the codes and java ifeel Concern when you talk about it

  7. #7
    misterwong Guest

    Re: Find element in table

    May i know whats your code actually about? And what is it for? Just say that i will give good positive respond. Have it good.

Similar Threads

  1. Replies: 1
    Last Post: 10-05-2012, 11:55 AM
  2. Replies: 5
    Last Post: 27-08-2011, 10:53 AM
  3. Replies: 5
    Last Post: 18-06-2011, 07:39 AM
  4. Link a Table to another Table to Drop Down In Main Table
    By himeshRES in forum Windows Software
    Replies: 6
    Last Post: 11-12-2010, 02:01 PM
  5. From Hash Table Remove an Unreferenced Element
    By Level8 in forum Software Development
    Replies: 5
    Last Post: 19-02-2010, 05:39 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,727,343,255.78301 seconds with 16 queries