HOME BZU Mail Box Online Games Radio and TV Live Cricket Score All Albums
Go Back   BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan Institute of Computing Bachelor of Science in Information Technology BsIT 2nd Semester Object Oriented Programming

Advertisement Banner

Program to enter 10 integers in a single-dimension array and then print out the array in ascending order


#include <iostream.h>
#include <conio.h>

void main()
{
clrscr();
int array[10],t;
for(int x=0;x<10;x++)
{
cout << "Enter Integer No. " << x+1 << " : " << endl;
cin>>array[x];
}
for (x=0;x<10;x++)
{
for(int y=0;y<9;y++)
{
if(array[y]>array[y+1])
{
t=array[y];
array[y]=array[y+1];
array[y+1]=t;
}
}
}
cout << "Array in ascending order is : ";
for (x=0;x<10;x++)
cout << endl << array[x];
getch();
}
This program takes in the ten integers array[x] to be stored in the single-dimensional array as a screen input from the user.
It then sorts out these ten integers into ascending order and prints them out using the 'cout' command.



Sample Input
43
67
53
21
6
78
92
48
95
8

Sample Output
Array in ascending order is :
6
8
21
43
48
53
67
78
92
95
Attached Files
File Type: docx Program to enter 10 integers in a single-dimension array and then print out the array in ascend.docx (12.3 KB, 51 views)
__________________

Reply With Quote
Top 10 Lists | Live Cricket Score

Reply

Tags
array, ascending, enter, integers, order, print, program, singledimension


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Program to enter three integers and output the smallest integer using IF bonfire Object Oriented Programming 0 09-03-2011 12:28 AM
Program to enter three integers and output the biggest integer bonfire Object Oriented Programming 0 01-03-2011 03:10 PM
Program to enter two integers and print the quotient and remainder bonfire Object Oriented Programming 0 01-03-2011 03:06 PM
Program to enter two integers and find their sum and average bonfire Object Oriented Programming 0 28-02-2011 10:46 PM
program of single array acting as multiple stacks taha khan Data Structure 2 28-10-2008 10:06 PM

Best view in Firefox
Free File Hosting | Webmaster Forum | Cloud Computing | Dedicated server hosting
Note: All trademarks and copyrights held by respective owners. We will take action against any copyright violation if it is proved to us.

All times are GMT +5. The time now is 12:53 AM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.