Monday, May 24, 2010

JAVA and DEV c++ SOURCE CODES...BADLY needed!n HELP ME PLS.?

PROBLEM:


Create the array as shown :





MyArray[10]={3,9,4,12,0,1,2,7,6,15}





Sort the array in an ascending order.





multiply all elements by 4 and put it on NewArray[10]





Display the two arrays.





FRagment code for dev c++: (Don't know how to compl8)





*for sorting (arranging from highest to lowest whch n my case,reverse/ascending)


EXAMPLE of FRAGMENTED CODE:





Int MyArray [5]={5,14,1,0,16};


int ja=5;


{


for (x=0;x%26lt;5;x++)


{


for (y=0;y%26lt;5;y++)


if (MyArray[y]%26lt;MyArray [y+1]


MyArray [y+1]=ja





OUTPUT SHOULD BE:


Int MyArray[5]={16,14,5,1,0}





*For getting the value and multiplying fragmented code in dev c++:


EXAMPLE:





int xa[5]={4,19,0,3,20};


int ya[5]= ???????????





for(int i=0;i%26lt;0;i++)


ya[i]=xa[i]*2;





OUPUT:


int xa[5]={4,19,0,3,20}


int ya[5]={8,48,0,9,40}





NOTE: MY PROBLEM IS a combination of both...badly needed b4 thursday,dec. 14.thanx!n java 2





output should look like this:





MyArray[10]={0,1,2,3,4,6,7,9,12,15}


NewArray[10]={0,4,8,12,16,24,36,48,60}

JAVA and DEV c++ SOURCE CODES...BADLY needed!n HELP ME PLS.?
ok so exactly what are you having trouble with the first part looks as if it would make any array less then the first array 5 so just by looking at it array[0] will never change ok so it should be something like this





if (myArray[y] %26lt; myArray[y+1] )


{


temp = myArray[y+1]


myArray[y+1] = myArray[y]


myArray[y] = temp


}





question what is the ja for


No comments:

Post a Comment