Skip to content

MyUstaadG

Learn to Serve

  • Computer Science
    • Software
    • Computer Tips
    • Coding
      • Conditional Structures Exercises
      • Loops Exercises
      • Arrays Exercises
      • Python Exercises
    • Microsoft Office
      • MS Excel
      • MS Word
  • Videos
    • Funny Videos
    • Health and Fitness Videos
    • PUBG Videos
    • Technology Videos
  • News
  • Funny
  • Memes
  • Playwright Tutorials
  • Tutorials
  • Toggle search form

Write a program that sorts an array ‘ABC’ in ascending order using the Bubble Sort method. The array consists of N elements.

Posted on October 26, 2021 By myustaadg.com
Spread the love

Write a program that sorts an array ‘ABC’ in ascending order using Bubble Sort method. The array consists of N elements.

So let’s Write Code:

Introduction to C++ Programming | Download and Install Dev C++ Compiler

Code:

Write a program that sorts an array ‘ABC’ in ascending order using the Bubble Sort method. The array consists of N elements.

#include<iostream>
using namespace std;
main()
{
int ABC[10], i, u, temp;
i = 0;
while(i<=9)
{
cout<<"Enter value for element "<<i<<"? ";
cin>>ABC[i];
i++;
}
u = 9;
while(u>=1)
{
i = 0;
while(i<u)
{
if(ABC[i] > ABC[i+1])
{
temp = ABC[i];
ABC[i] = ABC[i+1];
ABC[i+1] = temp;
}
i++;
}
u--;
}
cout<<"\nValues of array ABC in ascending order\n";
for(i = 0; i<=9; i++)
cout<<ABC[i]<<" ";
}

Hope You will learn Something. Happy Coding.

Visit my YouTube Channel as Well😇 https://www.youtube.com/watch?v=JuIHQ9cLSEw&list=PLbIhkHxfUIItTdcyCb34uRIrPJbXBndIl&index=4

Click on the below Links for more Programming Exercises:

Conditional Structure Exercises: 👉https://myustaadg.com/category/programming-exercises/conditional-structures-exercises/

Array Exercises: 👉https://myustaadg.com/category/programming-exercises/arrays-exercises/

Arrays Exercises, Programming Exercises Tags:array declaration in c++, Array Exercises, Array exercises in C++, array in Object oriented programming, Arrays, arrays codes, Arrays exercises, Arrays in C++, Arrays in C++ Programming with examples, Arrays in Programming, Arrays with example, Bubble Sort, C++ and C Program to Sort the Array in an Ascending Order, c++ arrays declaration and initialization, C++ Arrays with examples, C++ C program to sort the elements of an array in ascending order, C++ Program for Bubble Sort, C++ Program to sort an array in ascending order using Bubble Sort, C++ program to sort the elements of an array in ascending order, Creating and Using Arrays, how do you initialize an array in c++, How do you sort an array in ascending order using bubble sort?, How do you sort data in ascending and descending manner explain bubble sort?, How do you use bubble sort in ascending order?, Simple arrays code, Sorting Algorithms Explained with Examples in c++, Sorting Strings using Bubble Sort, Write a program in C++ to sort elements of array in ascending order, Write a program that sorts an array ‘ABC’ in ascending order using the Bubble Sort method. The array consists of N elements.

Post navigation

Previous Post: Write a program that searches a value in an array using the Sequential Search method and replaces it with another one.
Next Post: PUBG Best OP Fast Killer In New Style | PUBG Copyright Free Video | PUBG Copyright Free Video For YouTube Short

More Related Articles

Write a program that input amount from user to invest, the annual interest and the number of years, and shows on the screen the capital obtained in the investment | Python Programming Programming Exercises
Write a program to initialize values in two tables A and B. Multiply matrix A and B and store results into table C | Multiplication of matrices. Arrays Exercises
Write a program that initializes an array with the number of days of different months. It inputs the number of month and displays the number of days of the entered month. Arrays Exercises
Write a program that initializes values in two tables A and B. It adds tables A and B and stores result into table C. It also displays the values of three tables in tabular form on the screen. Arrays Exercises
Write a program that inputs real values into float type array. It reads the value of each element of float type array and assigns to int type array. Arrays Exercises
Write a program that input two integers and display Quotient and remainder on the screen | Python Programming Programming Exercises

Copyright © 2022 MyUstaadG.

Powered by PressBook Blog WordPress theme