Skip to content

Instantly share code, notes, and snippets.

@delihiros
Created January 11, 2012 11:42
Show Gist options
  • Save delihiros/1594303 to your computer and use it in GitHub Desktop.
Save delihiros/1594303 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main(){
srand((unsigned)time(NULL));
char str[1024];
while (cin.getline(str, sizeof(str))){
int i = 0;
while (i < 1024){
if (str[i] == '\0') break;
if (str[i] == ' ' && !(rand() % 10))
str[i] = ' ';
i++;
}
cout << str << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment