- juste une partie(les app visual studio sont composée des classes mfc inutiles ici...)
-
- void CTestDlg::OnBtnGen()
- {
- // TODO: Add your control notification handler code here
-
- m_max.GetWindowText(gen);
- int imax=atoi((char*)LPCTSTR(gen));
- char name[20]={'\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0',};
- if(imax>20)
- {
- int a=AfxMessageBox("tapez un nom inférieur a 20 svp!", MB_ICONSTOP); //si erreur nombre trop grand
- if(a==IDOK)
- {
- imax=0; //kan clik sur ok, remet a 0 pour retaper.
- goto bfor;
- }
- }
- bfor:
- for(int c=0;c<imax;c++) //attribution du tableau avec valeur aléatoire
- {
- name[c]=generer();
- }
- CString res(name);
- m_gen.SetWindowText(res);
- }
-
-
- /*..................*/
-
-
-
-
- char generer()
- {
- static bool zerone=0;
- static int a=0;
- srand(a);
- char voyelle[6];
- voyelle[0]='a';
- voyelle[1]='e';
- voyelle[2]='i';
- voyelle[3]='o';
- voyelle[4]='u';
- voyelle[5]='y';
-
- char consonne[20];
- consonne[0]='b';
- consonne[1]='c';
- consonne[2]='d';
- consonne[3]='f';
- consonne[4]='g';
- consonne[5]='h';
- consonne[6]='j';
- consonne[7]='k';
- consonne[8]='l';
- consonne[9]='m';
- consonne[10]='n';
- consonne[11]='p';
- consonne[12]='q';
- consonne[13]='r';
- consonne[14]='s';
- consonne[15]='t';
- consonne[16]='v';
- consonne[17]='w';
- consonne[18]='x';
- consonne[19]='z';
-
- a+=6;
-
- char tmp;
-
- if(zerone==0){
- int fuck2=(rand()%21)-1;
- zerone=1;
- tmp=consonne[fuck2];
- }
- if(zerone==1){
- int fuck=(rand()%7)-1;
- zerone=0;
- tmp=voyelle[fuck];
-
- }
- return(tmp);//retourne une valeur aléaoire
- }
-
-
-
-
-
-
juste une partie(les app visual studio sont composée des classes mfc inutiles ici...)
void CTestDlg::OnBtnGen()
{
// TODO: Add your control notification handler code here
m_max.GetWindowText(gen);
int imax=atoi((char*)LPCTSTR(gen));
char name[20]={'\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0',};
if(imax>20)
{
int a=AfxMessageBox("tapez un nom inférieur a 20 svp!", MB_ICONSTOP); //si erreur nombre trop grand
if(a==IDOK)
{
imax=0; //kan clik sur ok, remet a 0 pour retaper.
goto bfor;
}
}
bfor:
for(int c=0;c<imax;c++) //attribution du tableau avec valeur aléatoire
{
name[c]=generer();
}
CString res(name);
m_gen.SetWindowText(res);
}
/*..................*/
char generer()
{
static bool zerone=0;
static int a=0;
srand(a);
char voyelle[6];
voyelle[0]='a';
voyelle[1]='e';
voyelle[2]='i';
voyelle[3]='o';
voyelle[4]='u';
voyelle[5]='y';
char consonne[20];
consonne[0]='b';
consonne[1]='c';
consonne[2]='d';
consonne[3]='f';
consonne[4]='g';
consonne[5]='h';
consonne[6]='j';
consonne[7]='k';
consonne[8]='l';
consonne[9]='m';
consonne[10]='n';
consonne[11]='p';
consonne[12]='q';
consonne[13]='r';
consonne[14]='s';
consonne[15]='t';
consonne[16]='v';
consonne[17]='w';
consonne[18]='x';
consonne[19]='z';
a+=6;
char tmp;
if(zerone==0){
int fuck2=(rand()%21)-1;
zerone=1;
tmp=consonne[fuck2];
}
if(zerone==1){
int fuck=(rand()%7)-1;
zerone=0;
tmp=voyelle[fuck];
}
return(tmp);//retourne une valeur aléaoire
}