Thread: Need immmediate help with program (basic C++ stuff)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    17

    Question Need immmediate help with program (basic C++ stuff)

    Hello,
    I've writing a function to find the three largest integers in a 3rd dimensional array which has #0 to 9 stored exclusively. However, I keep getting the same highest # (usually 9) stored in max_store[]. I have tried everything, and I don't know where to go next. If some one could please offer me some help, I'd really appreciate it. I need this asap. Thank you so much.

    Code:
    void find_max(int fun[ROW][COL][LAYER]) {
       
       int num, r, c, l, k;
       int max=0;
       int max_store[3]={-1};
    
       for (num=0; num < 3; num++) {
          for (r=0; r < ROW; r++) {
             for (c=0; c < COL; c++) {
                for (l=0; l < LAYER; l++) {
                   for (k=0; k < 3; k++) {                         
                      if (max < fun[r][c][l] && max_store[k] != max)
                         max = fun[r][c][l];
                   }
                       
                }
                
             }  
              
          }
          
          max_store[num] = max; 
          max = 0;
         
          
       }
    Justin

    P.S. If you want to look at entire source file, I attached it to this thread.
    Last edited by YevGenius; 04-30-2003 at 09:54 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Basic C input output program help
    By trevordunstan in forum C Programming
    Replies: 2
    Last Post: 01-27-2008, 06:41 PM
  2. Advice on writing a basic encryption program?
    By osiris^ in forum C Programming
    Replies: 2
    Last Post: 09-10-2007, 02:02 PM
  3. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  4. Help me with my basic program, nothing I create will run
    By Ravens'sWrath in forum C Programming
    Replies: 31
    Last Post: 05-13-2007, 02:35 AM
  5. IDEA: A basic drawing program
    By ygfperson in forum Contests Board
    Replies: 0
    Last Post: 08-12-2002, 11:15 PM