Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- using namespace std;
- int main(int argc, char** argv) {
- /*int n;
- cin>>n;
- int T[n];
- for(int i =0;i<n;i++)
- {
- cin>>T[i];
- }*/
- string T = "napis";
- int n = T.size();
- int i=1;
- while(i<n)
- {
- int pom=T[i];
- int k=i-1;
- while(k>=0 && T[k]>pom)
- {
- T[k+1]=T[k];
- k--;
- }
- T[k+1]=pom;
- i++;
- }
- for(int i=0;i<n;i++)
- {
- cout<<T[i];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement