Thread: Simple question ?

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    44

    Simple question ?

    hey guys,

    If I have a two dimensional array with these values

    double power [NROWS] [NCOLS];

    I read these values from a file and what I need to do is count how many values are over 283.

    267 267 283 321
    12 23 324 543
    234 454 232 453

    display will be There are 6 values over 283

  2. #2
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    A loop, a counter variable, a if statement and some basic logic.
    Woop?

  3. #3
    C / C++
    Join Date
    Jan 2006
    Location
    The Netherlands
    Posts
    312
    Use nested for loops, of course. Something like this:

    Code:
    for(int a.........)
    {
        for(int b....)
        {
            if(arr[a][b] > ...)
            else...
        }
    }
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple question regarding variables
    By Flakster in forum C++ Programming
    Replies: 10
    Last Post: 05-18-2005, 08:10 PM
  2. Simple class question
    By 99atlantic in forum C++ Programming
    Replies: 6
    Last Post: 04-20-2005, 11:41 PM
  3. Simple question about pausing program
    By Noid in forum C Programming
    Replies: 14
    Last Post: 04-02-2005, 09:46 AM
  4. simple question.
    By InvariantLoop in forum Windows Programming
    Replies: 4
    Last Post: 01-31-2005, 12:15 PM
  5. simple fgets question
    By theweirdo in forum C Programming
    Replies: 7
    Last Post: 01-27-2002, 06:58 PM