Code |
void INSERT_INTO_erets2_(int LO, int HI, int loopN)
{
int r_int, n=10;
char cch, nev[11];
int anya_szam,jegy1,jegy2,jegy3,jegy4,atlag;
int mem1, mem2;
string osztaly;
srand (static_cast < unsigned> (time(0)));
for(int i=0; i<=loopN; i++)
{
// [anyaszam]
anya_szam=i;
// [Nev]
string nev;
vector< string> firstNames = {"John", "Jane", "Alex", "Emily", "Chris", "Katie"};
vector< string> lastNames = {"Smith", "Doe", "Brown", "Johnson", "Williams", "Jones"};
string firstName = getRandomName(firstNames);
string lastName = getRandomName(lastNames);
nev= "'" + firstName + ' ' + lastName;
// [osztaly]
string osztaly;
osztaly += 'A' + rand()%7;
osztaly += "'";
// [evfoly]
string evfoly;
int num = rand()%12+4;
if(num<12) evfoly+=to_string(num);
else evfoly+=to_string(12);
evfoly += "'";
// [jegyek]
LO=1; HI=11;
float r3 = LO + static_cast < float> (rand()) /( static_cast < float> (RAND_MAX/(HI-LO)));
r3 *= 100; r_int= r3; r3 = r_int; r3 /= 100;
if(r3>10)r3=10;
jegy1=r3;/*
r3 = LO + static_cast < float> (rand()) /( static_cast < float> (RAND_MAX/(HI-LO)));
r3 *= 100; r_int= r3; r3 = r_int; r3 /= 100;
if(r3>10)r3=10;
jegy2=r3;
r3 = LO + static_cast < float> (rand()) /( static_cast < float> (RAND_MAX/(HI-LO)));
r3 *= 100; r_int= r3; r3 = r_int; r3 /= 100;
if(r3>10)r3=10;
jegy3=r3;
r3 = LO + static_cast < float> (rand()) /( static_cast < float> (RAND_MAX/(HI-LO)));
r3 *= 100; r_int= r3; r3 = r_int; r3 /= 100;
if(r3>10)r3=10;
jegy4=r3;
atlag = ( jegy1 + jegy2 + jegy3 + jegy4 ) / 4;
*/
cout << "INSERT INTO `test`(`evfoly`, `osztaly`, `nev`, `jegy`) VALUES ('"
//<< anya_szam <<", "
<< evfoly <<", '"
<< osztaly <<", "
<< nev <<"' ,"
<< jegy1 /*<<", "
<< jegy2 <<", "
<< jegy3 <<", "
<< jegy4 <<", "
<< atlag*/
<< ");" << endl;
}
}
int main()
{
char x[100]="osztaly.nev.jegy";
INSERT_INTO_erets2_(4,11, 20);
//INSERT_INTO_constr(4,2,10,15,"`test_table`(nev, eletkor, evfolyam)");
//cycle(3,x);
}
|
Back |
linke |