•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 397,768 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,478 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 1321 | Replies: 0
![]() |
•
•
Join Date: Dec 2004
Location: Nashville, TN
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
I am being asked to take a number like 86249 and produce the output 24689. Basically take a number and print it in ordered form. I can do this with an array of multiple numbers, but can't figure out how to split the number entered into an array so this can be done. Am I following the right logic or am I way off base?
#include<iostream.h>
void main()
{
int arr[50];
int size, temp;
do{
cout<<"Enter the size of the array(max 50): ";
cin>>size;
}while(size>50 || size <1);
cout<<"\nEnter the values: ";
for(int i=0; i<size; i++)
cin>>arr[i];
for(i=0; i<size-1;i++)
for(int j=i+1; j<size;j++)
if(arr[i]>arr[j])
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
cout<<"\nthe sorted array is: ";
for(i=0; i<size; i++)
cout<<arr[i];
cout<<"\n";
}![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
Similar Threads
- Shopping Cart Not Working (ASP.NET)
- print large pricturebox or form in vb6 (Visual Basic 4 / 5 / 6)
- Stuck a bit on input (C)
- Armstrong numbers (C)
- Parse a concatenated variable and string? (PHP)
- Can someone tell me what i am doing wrong? (Java)
- Populating a fields on a form base on a selected item from a droplist. (PHP)
- Random number generation (C)
- Recursive prime number f(x) (C)
Other Threads in the C++ Forum
- Previous Thread: help with getting soda machine program running
- Next Thread: Need help with a function


Linear Mode