Posted by: Brain Malfunction July 17, 2008
NEED HELP IN VISUAL BASIC.NET "URGENT"
Login in to Rate this Post:     0       ?        

Balbahadur,

try to be clear on your problem specification.. people in SAJHA might be expert programmers but they are not mind readers

Following is the C++ code.. Might be some VB Guru will show up and translate it for you.. The main thing here is finding the lowest score. Once lowest is found, you can easily calculate the average of the remaining scores i.e. calAverage()..

 

#include <iostream>
#include <iomanip>
using namespace std;

//Function Prototype
void getValues();
void findLowest( int testScore[], int sz );
void calcAverage();

int main()
{
    cout << "This program shows the full use of using functions ";
    cout << "to calculate the average of a series of tests.";

    getValues(); // The first function called
    // findLowest(); // This function is called second
    // calcAverage(); // Lastly, the third function is called

    cout << "Now, that is how you calculate the average of a ";
    cout << "series of tests.";

    return 0;
}

//**********************************************
// Definition of function getValues. *
// This function asks for five test scores and *
// stores them in variables. *
//**********************************************

void getValues()
{
    const int size = 5;
    int scores[size];

    cout << "Enter in " << size << " test scores and I will store ";
    cout << "them in variables.\n";

    for ( int i = 0; i < size; i++ )
    {
        cout << "Enter score " << ( i + 1 ) << " : ";
        cin >> scores[i];
    }

    findLowest( scores, size ); // pass the address and size of the scores array

    cout << fixed << showpoint << setprecision(2);
}

//**************************************************   *****
// Definition of function findLowest. *
// This function determines which out of those *
// five test scores is the lowest and return that value *
//**************************************************   *****

void findLowest( int testScore[], int sz )
{
    int lowest = testScore[0]; // make the first element of the array the lowest.
                               // loop through the array and compare the rest with
                               // first element.

    for ( int i = 0; i < sz; i++ )
    {
        if ( testScore[i] < lowest )
        {
            lowest = testScore[i];
        }
    }

    cout << "The lowest is " << lowest << endl;
}

//**************************************************   *****
// Definition of function calAverage. *
// This function determines the average of four highest test scores *
// and return that value * Balabahadur did this part of assignment himself

//**************************************************   *****

void calAverage( int testScore[], int sz )
    {

      //Calculate the average of 4 scores, you can left shift the sum two times to divide by 4.

      }

Read Full Discussion Thread for this article