The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
Prvi manji
Posted by: Evgenije | February 4, 2010 @ 7:03am
C++ Code
[
Download
]
#include <iostream> #include <algorithm> #include <string> using namespace std; bool cmp( int a, int b ) { return a > b; } int main() { string broj; cin>>broj; int i=broj.length()-1; while (i>0){ char prethodni=broj[i]; i--; char sljedeci=broj[i]; while (prethodni>sljedeci){ prethodni=sljedeci; i--; sljedeci=broj[i]; } char karakteristika=sljedeci; for (int j=broj.length()-1;j>i;j--){ if (broj[j]<karakteristika){ broj[i]=broj[j]; broj[j]=karakteristika; sort(broj.begin()+j,broj.end(),cmp); cout<< broj; return 0;} } } cout<<"Nema takvog"; return 1; }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.50 / 8
62 Votes
http://codebin.yi.org/479
page generated in 0.01 seconds