Monday, 26 September 2011

coding tok final APR 2010 part c (Q2)

cek anis..
try coding...
aku xwat lam proper words.. tp lbey kuag cmni la...

#include <iostream.h>

int larger (int [], int);

void main ()
{

    int value[3];
    int max, d, x, total[3];

    cout<<"Enter value (less then 100): ";

    for (x=0; x<3; x++)
    {
        cin>>value[x];
    }

    max=larger(value, 3);

    d = 100 - max;

    cout<<"The max no: "<<max<<endl;
    cout<<endl;
   
    for (x=0; x<3; x++)
    {

        total[x] = d + value[x];
    }
   
    for (x=0; x<3; x++)
        cout<<"After: "<<total[x]<<endl;


}

int larger (int list[], int array)
{

    int swap, index, x;

    do
    {
        swap=0;

        for (x=0; x<(array-1); x++)
        {

            if (list[x] > list[x+1])
            {

                index = list[x];
                list[x] = list[x+1];
                list[x+1] = index;
                swap=1;
            }
        }
    }while (swap != 0);

    return list[2];
}



♥ DaH BaCE..? tOLonG KLik BaWAh NiE PlaK ^_^ mEKasiH ♥


TaNx FoR REadiNG ^_^ SilA KoMEn APe yG PaTOt yE..

2 si cumel lemparkan senyuman:

Unknown said...

laa.. apesal aku xleh view pun? :(

cik_miemy said...

xbley view ape >.< huhu
ni coding tok c++ le..

Pages