Homework Assignment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kaloshi
    New Member
    • Nov 2006
    • 6

    Homework Assignment

    Write the C++ code that will count the number of elements in an array
    (named number) of base type int, that are equal to a key value named key_value. The number of components is saved in the variable: size.


    ?
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Originally posted by kaloshi
    Write the C++ code that will count the number of elements in an array
    (named number) of base type int, that are equal to a key value named key_value. The number of components is saved in the variable: size.


    ?
    Hi. What part do you need help with, or do you need someone here with a lot of time on their hands to write the entire project for you?

    Comment

    • DeMan
      Top Contributor
      • Nov 2006
      • 1799

      #3
      Code:
      int counter=0;
      for(int i=0; i<size; i++)
      {
        if(number[i]=value)
        {
          counter++;
        }
      }

      Comment

      Working...