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];
}
2 si cumel lemparkan senyuman:
laa.. apesal aku xleh view pun? :(
xbley view ape >.< huhu
ni coding tok c++ le..
Post a Comment