Click here to Skip to main content
15,909,822 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Random Name Generator Pin
Chuck Vought14-Aug-09 10:26
Chuck Vought14-Aug-09 10:26 
GeneralRe: Random Name Generator Pin
David Crow14-Aug-09 10:37
David Crow14-Aug-09 10:37 
GeneralRe: Random Name Generator Pin
Chuck Vought14-Aug-09 11:00
Chuck Vought14-Aug-09 11:00 
QuestionRe: Random Name Generator Pin
David Crow14-Aug-09 11:04
David Crow14-Aug-09 11:04 
AnswerRe: Random Name Generator Pin
Chuck Vought14-Aug-09 11:11
Chuck Vought14-Aug-09 11:11 
GeneralRe: Random Name Generator Pin
David Crow14-Aug-09 11:13
David Crow14-Aug-09 11:13 
GeneralRe: Random Name Generator Pin
Chuck Vought14-Aug-09 11:19
Chuck Vought14-Aug-09 11:19 
GeneralRe: Random Name Generator Pin
Chuck Vought14-Aug-09 15:12
Chuck Vought14-Aug-09 15:12 
It is working without errors except that it seems to only create a first or last name with the number of character for firstname only. If i enter 3 for firstname and 10 for last name i still only get 3 letters?

vector <string> firstnames;
vector <string> lastnames;
string lastname;
string firstname;	
static const char* letters[2] = { "bcdfghjklmnpqrstvwxyz", "aeiouy" };
static const  int letterlength[2] = { strlen(letters[0]), strlen(letters[1]) };
srand(time(NULL));
		
for (int j=0; j<num; j++)
{
	for (int i=0; i<numFirst; i++)
		{
			firstname += letters[i%2][rand()%letterlength[i%2]];
		}
				
		firstname[0]=toupper(firstname[0]);
		firstnames.push_back(firstname);
		firstname = "";
}

for (int x=0; x<num; x++)
{
	for (int y=0; y<numLast; y++)
	{
	lastname += letters[i%2][rand()%letterlength[i%2]];
	}
		lastname[0]=toupper(lastname[0]);
		lastnames.push_back(lastname);
		lastname = "";
	}
}

for(z=0;z<num;z++)
{
   cout <<firstnames[z].c_str()<<" " << lastnames[z].c_str()<<endl;
 	
}

GeneralRe: Random Name Generator Pin
David Crow15-Aug-09 5:20
David Crow15-Aug-09 5:20 
AnswerRe: Random Name Generator Pin
Chuck Vought14-Aug-09 10:19
Chuck Vought14-Aug-09 10:19 
GeneralRe: Random Name Generator Pin
David Crow14-Aug-09 10:27
David Crow14-Aug-09 10:27 
GeneralRe: Random Name Generator Pin
Chuck Vought14-Aug-09 10:36
Chuck Vought14-Aug-09 10:36 
GeneralRe: Random Name Generator Pin
sashoalm15-Aug-09 4:20
sashoalm15-Aug-09 4:20 
GeneralRe: Random Name Generator Pin
Chuck Vought15-Aug-09 13:35
Chuck Vought15-Aug-09 13:35 
Questionflowing strings on BMP image of SDI View window? Pin
rambojanggoon12-Aug-09 21:39
rambojanggoon12-Aug-09 21:39 
AnswerRe: flowing strings on BMP image of SDI View window? Pin
KarstenK12-Aug-09 22:04
mveKarstenK12-Aug-09 22:04 
Questionhow to display many picture in 1 dialog Pin
DevelopmentNoob12-Aug-09 19:32
DevelopmentNoob12-Aug-09 19:32 
AnswerRe: how to display many picture in 1 dialog Pin
DevelopmentNoob12-Aug-09 19:42
DevelopmentNoob12-Aug-09 19:42 
GeneralRe: how to display many picture in 1 dialog Pin
Code-o-mat12-Aug-09 21:27
Code-o-mat12-Aug-09 21:27 
GeneralRe: how to display many picture in 1 dialog Pin
DevelopmentNoob12-Aug-09 23:45
DevelopmentNoob12-Aug-09 23:45 
GeneralRe: how to display many picture in 1 dialog Pin
Code-o-mat13-Aug-09 0:08
Code-o-mat13-Aug-09 0:08 
GeneralRe: how to display many picture in 1 dialog [modified] Pin
DevelopmentNoob13-Aug-09 15:24
DevelopmentNoob13-Aug-09 15:24 
GeneralRe: how to display many picture in 1 dialog Pin
Code-o-mat13-Aug-09 20:59
Code-o-mat13-Aug-09 20:59 
GeneralRe: how to display many picture in 1 dialog Pin
DevelopmentNoob13-Aug-09 21:22
DevelopmentNoob13-Aug-09 21:22 
GeneralRe: how to display many picture in 1 dialog Pin
Code-o-mat13-Aug-09 21:43
Code-o-mat13-Aug-09 21:43 

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.