28 Mar 2018 0 comments

program DepreciationProgram; uses crt; label Return; var method,years,years2,life,sumofyears:integer; originalValue,depreciation,depfactor:real; remainingvalue:real; begin return:Clrscr(); writel...

Read More
18 Feb 2018 0 comments

Write a program in Pascal language that allows the user to enter a student’s name and mark obtained in a Maths examination. The program should prompt the user to enter name and mark, check that mark...

Read More
07 Feb 2018 0 comments

A while statement  is utilized to execute a statement  as long as a specific condition holds A while-do circle statement in Pascal permits dreary calculations till some test conditio...

Read More
17 Jan 2018 0 comments

A program to check the health of a number of persons has to be written. Each person is asked to enter his/her body temperature (T) and one of the following messages is displayed: ‘You are in good h...

Read More
16 Nov 2017 0 comments

program hello;   var   i:integer;    var   sum, number:integer;   a: integer; begin writeln('############# multiple of 5 to 50 in repeat #############'); i:=0; ...

Read More
15 Nov 2017 0 comments

Hello! friends today we will learn how to generate a bill for power holding corporation of Nigeria(PHCN), using Pascal programming language. to start with, all you require is your pascal IDE to emp...

Read More
27 Sep 2017 0 comments

Here might be a circumstance when you have to execute a square of code a few quantities of times. As a rule, statements are executed successively: The first statement in a capacity is executed t...

Read More
27 Sep 2017 0 comments

The for loop The "for loop" loops starting with one number then onto the next number and increments by a predetermined value each time. syntax  for (Start value; end condition; increase ...

Read More

Latest Posts:

bubble sorting in c++ program codeing.Bubble sort, once in a while alluded to as sinking sort,

Bubble sort, once in a while alluded to as sinking sort, is a straightforward arranging calculation that over and over strides through the rundown to be arranged, thinks about each combine of nearby things and swaps them on the off chance that they are in the wrong request.
The go through the rundown is rehashed until the point that no swaps are required, which demonstrates that the rundown is arranged. The calculation, which is a correlation sort, is named for the way littler or bigger components "rise" to the highest priority on the rundown. Despite the fact that the calculation is basic, it is too moderate and unreasonable for most issues notwithstanding when contrasted with addition sort.[2] It can be pragmatic if the information is normally in arranged request yet may at times have some out-of-arrange components about in position.

In the Bubble sort, as components are arranged they slowly "Bubble" (or ascend) to their legitimate area in the cluster, similar to bubbles ascending in a glass of pop. The air pocket sort over and again thinks about neighboring components of a cluster. The first and second components are analyzed and swapped if out of request. At that point the second and third components are thought about and swapped if out of request. This arranging procedure proceeds until the point that the last two components of the cluster are looked at and swapped if out of request.






1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//Bubble sort in this example
#include<iostream>
using namespace std;
int main(){
 //Declare the Array
 int array[5]; 
 cout<<"Enter 5 Numbers Randomly"<<endl;
 for(int i=0; i<5;i++)
 {
  //Talke input in array
  cin>>array[i];
 }
 cout<<endl;
  cout<<"Input array is"<<endl;
 for(int j=0;j<5;j++){
  //Displaying array
  cout<<"\t\t\tvalue of "<<j<<" index "<<array[j]<<endl;
 }
 cout<<endl;
 //Bubble Sort;
 int temp;
 for(int i2=0;i2<=4;i2++){
 for(int j=0;j<4;j++){
  //Swapping Element in if statement
  if (array[j]>array[j+1]){
   temp=array[j];
   array[j]=array[j+1];
   array[j+1]=temp;
  }
 }
 }
 //Display Sorted Array
 cout<<"Sorted Array is "<<endl;
 for(int i3=0;i3<5;i3++){
  cout<<"\t\tvalue at "<<i3<<" index "<<array[i3]<<endl;
 }
 return 0;
}

it would be ideal if you dont fall flat remark any mistake on the code
Share on Google Plus

About Lucky Ibitubo

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

Powered by Blogger.