Look into bubble sort, it is one of the simplest sorting algorithms.
To write a C++ program to display the student details using class and array of object.
Sort the array then traverse the array, printing the element values as you go.
Accept 5 numbers in an array and display it.
In Maths, we often talk about ascending and descending order. Ascending order is writing numbers from smallest to largest. Descending order is writing numbers from largest to smallest.
public class BubbleSortAscendingOrderDemo { public static void main(String a[]) { //Numbers which need to be sorted int numbers[] = {23,5,23,1,7,12,3,34,0}; //Displaying the numbers before sorting System.out.print("Before sorting, numbers are "); for(int i = 0; i < numbers.length; i++) { System.out.print(numbers[i]+" "); } System.out.println(); //Sorting in ascending order using bubble sort bubbleSortInAscendingOrder(numbers); //Displaying the numbers after sorting System.out.print("Before sorting, numbers are "); for(int i = 0; i < numbers.length; i++) { System.out.print(numbers[i]+" "); } }
To write a C++ program to display the student details using class and array of object.
Sort the array then traverse the array, printing the element values as you go.
the following program will display all numbers given in the array in ascending order #include<stdio.h> void main() { int i,h,p; int numbers[10]={5,8,3,2,6,7,9,4,1,10}; for(p=0;p<=8;p=p+1) { for(i=0;i<=8;i=i+1) { if(numbers[i]>numbers[i+1]) { a=numbers[i]; numbers[i]=numbers[i+1]; numbers[i+1]=a; } } } for(i=0;i<=9;i=i+1) { printf("%d ",numbers[i]); } }
Ascending order is when numbers are arranged from the smallest to the largest. Descending order is when numbers are arranged from the largest to the smallest.
Find your own answers....sucks mahn
draw a flow chart to arrange 3 numbers in ascending order
There are 84 such numbers.
Highlight the numbers and click on the sort button. You can sort ascending (smallest to largest) or descending (largest to smallest).
I know how to do this and you need to know how to do this. Why don't you do your best at writing this program and if it does not work then ask for help. You will not learn anything if I give you the answer.
Ascending is an order in which things can be sorted. Ascending would be going from A to Z or lowest to highest numbers or earliest to latest dates.
i=1 while [ $i -le $# ] do grep -v Unix $i > $i done
das