Thread: Trouble with function

  1. #16
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    That would print the correct value for min_x, but (1) it would have completely meaningless values for i and j, not the values where the minimum/s is/are, and (2) it would print once for every day, not JUST the days where the minimum was met.
    Last edited by tabstop; 11-09-2008 at 11:53 PM. Reason: accuracy

  2. #17
    Registered User
    Join Date
    Oct 2008
    Posts
    48
    so when power[i][j]==min_x i need to print i and j, now how do i do that in a for loop?

  3. #18
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Just like you have it -- if power[i][j]==min_x, print i and j.

  4. #19
    Registered User
    Join Date
    Oct 2008
    Posts
    48
    ohhhh got it i believe, so
    [code]for(i=0; i <NROWS; i++)
    for(j=0; j<NCOLS; j++)
    if(power[i][j] == min_x)
    printf("Week: &#37;d Day: %d \n", i+1, j+1);

  5. #20
    Registered User
    Join Date
    Oct 2008
    Posts
    48
    ohhhh got it i believe, so
    [code]for(i=0; i <NROWS; i++)
    for(j=0; j<NCOLS; j++)
    if(power[i][j] == min_x)
    printf("Week: &#37;d Day: %d \n", i+1, j+1);[\code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  2. Having Trouble Passing typedef Arrays to a Function
    By jlharrison in forum C Programming
    Replies: 1
    Last Post: 03-27-2006, 12:06 PM
  3. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Replies: 4
    Last Post: 11-23-2003, 07:15 AM