Sunday, July 26, 2009

C programing help?

C programing Software : Turbo C ver.2 Borland





Write a program that accepts any number of value (up to100) from the terminal and sorts them in decending order (highest number first ).USe some alpha character ,such as q to end input.





Variables


Choose appropriate variables





OUTPUT


Input numbers,


%26gt;27


%26gt;92


%26gt;-116


%26gt;41


%26gt;.007


%26gt;-0.007


%26gt;0





Here they are in descending order


92 41 27 0.007 -0.007 -116





My assigment due in 1 week

C programing help?
Here is the code for a Selection Sort. That's the main part of the program. You should be able to do the rest pretty easily.





void selectionSort(int numbers[], int array_size)


{


int i, j;


int min, temp;





for (i = 0; i %26lt; array_size-1; i++)


{


min = i;


for (j = i+1; j %26lt; array_size; j++)


{


if (numbers[j] %26lt; numbers[min])


min = j;


}


temp = numbers[i];


numbers[i] = numbers[min];


numbers[min] = temp;


}


}
Reply:Stand up on your own legs, if not in your life yo have to suffer, now you have one week of time to do you home work, just open google and type "sorting program in c" by this you can get list of program or list ideas by that experiment them on you system if you have c configered in you system see the result by this you some satisfaction that wore one programm.





here is example program for you


http://www.engin.umd.umich.edu/CIS/cours... but understand it and try it dont just submit it as your home work.
Reply:Are you asking us to do your homework for you???


No comments:

Post a Comment