Click here to Skip to main content
16,006,475 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: need help in program Pin
David Crow7-Feb-06 6:32
David Crow7-Feb-06 6:32 
GeneralRe: need help in program Pin
taurus7777-Feb-06 7:01
taurus7777-Feb-06 7:01 
GeneralRe: need help in program Pin
Maximilien7-Feb-06 7:41
Maximilien7-Feb-06 7:41 
GeneralRe: need help in program Pin
taurus7777-Feb-06 8:19
taurus7777-Feb-06 8:19 
GeneralRe: need help in program Pin
David Crow7-Feb-06 8:25
David Crow7-Feb-06 8:25 
GeneralRe: need help in program Pin
Maximilien7-Feb-06 9:39
Maximilien7-Feb-06 9:39 
GeneralRe: need help in program Pin
taurus7777-Feb-06 10:23
taurus7777-Feb-06 10:23 
GeneralRe: need help in program Pin
Nitron7-Feb-06 10:41
Nitron7-Feb-06 10:41 
This should work:
#include <string>
#include <algorithm>

std::string GenerateString(const std::string& input)
{
	std::string output("abcdefghijklmnopqrstuvwxyz");

	for(int i=0; i<2; i++)
	{
		std::remove(output.begin(), output.end(), input.at(i));
	}

	std::random_shuffle(output.begin(), output.end());
	output.resize(3);
	output.insert(0, input);

	return output;
}


[edit]of course, you better check the size of input to make sure it has 2 chars in it, else you'll get an exception. [/edit]

~Nitron.
ññòòïðïðB A
start


-- modified at 16:44 Tuesday 7th February, 2006
GeneralRe: need help in program Pin
Wim Engberts7-Feb-06 22:22
Wim Engberts7-Feb-06 22:22 
GeneralRe: need help in program Pin
beko7-Feb-06 23:54
beko7-Feb-06 23:54 
GeneralRe: need help in program Pin
taurus7778-Feb-06 5:13
taurus7778-Feb-06 5:13 
QuestionListBox Pin
Mike Winter7-Feb-06 5:42
Mike Winter7-Feb-06 5:42 
AnswerRe: ListBox Pin
Blake Miller7-Feb-06 6:06
Blake Miller7-Feb-06 6:06 
GeneralRe: ListBox Pin
Mike Winter7-Feb-06 6:20
Mike Winter7-Feb-06 6:20 
Questiontemplates Pin
Russell'7-Feb-06 4:37
Russell'7-Feb-06 4:37 
AnswerRe: templates Pin
toxcct7-Feb-06 4:49
toxcct7-Feb-06 4:49 
GeneralRe: templates Pin
Russell'7-Feb-06 4:57
Russell'7-Feb-06 4:57 
GeneralRe: templates Pin
toxcct7-Feb-06 5:03
toxcct7-Feb-06 5:03 
GeneralRe: templates Pin
Russell'7-Feb-06 5:24
Russell'7-Feb-06 5:24 
GeneralRe: templates Pin
toxcct7-Feb-06 5:27
toxcct7-Feb-06 5:27 
AnswerRe: templates Pin
BadKarma7-Feb-06 4:56
BadKarma7-Feb-06 4:56 
GeneralRe: templates Pin
Russell'7-Feb-06 5:20
Russell'7-Feb-06 5:20 
GeneralRe: templates Pin
BadKarma7-Feb-06 5:48
BadKarma7-Feb-06 5:48 
AnswerRe: templates Pin
Michael Dunn7-Feb-06 7:17
sitebuilderMichael Dunn7-Feb-06 7:17 
QuestionActiveX with Visual Studio 6.0 Pin
MrChefman7-Feb-06 4:28
MrChefman7-Feb-06 4:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.