Public feed #601964

Something

public text v1 · immutable
Raw Edit
·published 2007-07-03 20:32 UTC
rendered paste body
#include <iostream>
#include <string>

using std::cout;
using std::cin;
using std::endl;
using std::string;

void displayPerms(string perms[100]) {
	for (int c =0; c < 100; c ++) {
	if (perms[c] != "") {
		cout << perms[c]<<endl;;
	}
	}
}
int main() {
	string permstr;
	int permstrlen;
	string perms[100];	
	cout<< "Enter a string:";
	getline(cin, permstr);
	permstrlen = permstr.length();
	int pc = 0;
	for (int c2 = 0; c2 < permstrlen; c2 ++) {
	
	for (int c=c2 + 1; c < permstrlen; c++) {
		perms[pc] = permstr[c2];
		perms[pc] += permstr[c];
		pc ++;
	}
	
	}
	displayPerms(perms);
	return -1;
}