Thread: Is their something wrong here?

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    11

    Is their something wrong here?

    Code:
    #include <iostream>
    
    using namespace std;
    
    void displayScores(const int scores[], int size);
    int numPassing(const int scores[], int size);
    
    int main()
    {
    	int scores[] = {0, 11, 22, 33, 44, 55, 66, 77, 88, 99};
    	int size = 10;
    	int count = 0;
    
    		
    	displayScores(scores, size);
    	
    	cout << endl << "The number of passing scores is: " << count << endl << endl;
    	
    	numPassing(scores, size);
    	
    		return 0;
    }
    
    void displayScores(const int scores[], int size)
    {
    	cout << "The test scores in the array are : " << endl;
    	for (int i = 0; i < size; i++)
    		cout << "  " << scores[i] << endl;
    }
    
    int numPassing(const int scores[], int size)
    {
    
    	int count = 0;
    
    		for (int i = 0; i < size; i++)
    		if (scores[i] > 59) 
    		count++;
        
    	return count; 
    
    }
    I have no errors whats so ever.. man i cant figure it out why its not working!

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Code:
    	cout << endl << "The number of passing scores is: " << count << endl << endl;
    	
    	numPassing(scores, size);
    Code:
    	count = numPassing(scores, size);
    
    	cout << endl << "The number of passing scores is: " << count << endl << endl;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 07-15-2004, 03:30 PM
  2. Debugging-Looking in the wrong places
    By JaWiB in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2003, 10:50 PM
  3. Confused: What is wrong with void??
    By Machewy in forum C++ Programming
    Replies: 19
    Last Post: 04-15-2003, 12:40 PM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 12:01 PM
  5. Whats wrong?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 07-14-2002, 01:04 PM