Hello,
I know that algorithm has a shuffle function. Someone told me when I was making my program in a chat room lol. but I wanted to make it anways to see if I can do it. Please leave feed back and tell me what you think and improvements and stuff. Thanks. BYebye
Code:
#include <iostream>
#include <time.h>
using namespace std;
void Scramble(string &s){
int scram_num=s.size()*s.size();
srand(time(NULL));
for(int a=0;a<scram_num;a++){
int i=rand()%s.size();
char c=s[i];
s.erase(i,1);
int ii=rand()%s.size();
s.insert(ii,1,c);
}
}
int main(){
string s="Country";
Scramble(s);
for(unsigned int i=0;i<s.size();i++){
cout<<s[i];
}
system("PAUSE");
return 0;
}