Beginner Exercises

Pages: 1... 56789... 16
Yeah, what if I were reading that on a video-mode 3 OS with an 80 * 24 char screen? (80 cols, 24 lines; like DOS or UNIX)?

It'd take me ages to scroll down in more (or less (more or less, haha, that's the joke!)) holding the down arrow key!
ooo that site is fun, clicking on all the links.... some guy pasted 5 pages in a row of memory locations.
I used to know someone named Jesus although he was Spanish so his name was pronounced:
hey-zeus
And I saw someone named Jesus in my school when I was young. Although why someone would name their child Jesus is beyond me ...

On a side note:
Jack Hammer
Ben Dover

Are 2 of my sister's children at a daycare thing.
Pfft. Quite obviously, the proper name for someone whose last name is "Hammer" would have to be "Time".
You should be ashamed of yourself.
There was a girl at my high school named "Fler" star sign Libra. AKA tampon girl, as the most popular brand of Tampons at that time was Libra Fler.

Primary school there was a guy from Yugoslavia or somewhere around there, his name was "Bogdan Peuw" lots of poopoo jokes from 7year olds, he changed his name to Alex just before highschool :P

Ben Dover is just cruel...
Mind you my brother in law wants to name his son "Farqua" or however you spell it from shrek.

OI COMERE FARQUA!!!
Last edited on
Compare locations of the full-stop/period.)

If your sister (or brother?) let's him, you should hit him (the brother-in-law). That's child abuse.

Ben Dover is just cruel...

Yeah... A common joke amongst what we shall call "football fans" (Americans, read "soccer" (British football was invented first, ergo it's the real football. Also in football they actually use their feet as a primary weapon) is that two footballers are called "Ben Dover" and "Paul Dickov." If you pronounce the last V as a double-f... In fact, it may actually be "Dickoff," or some other spelling; but I thought that seemed too unlikely.

Note: I am not a football fan, actually, I hate it. Playing it, watching it, hearing these "football fans" talking and arguing about it (and not in the way programmers might argue about programming; they download pictures of the football team's rival's logo and draw people urinating on it, or otherwise harming it).
I am not into sports either. On football I really had forgotten you guys read soccer which reminds me of a conversation I was having with someone ...

Other guy: I live in Britain you?
Me: USA.
... (comparisons between USA/Britain)
Other guy: You guys are funny because you call "trousers "pants"
Me: And british are funny because you call "pants" "trousers"

Of course I cleaned up his grammr becuz brits r liek sooooo bad @ grmmr
Ironically, I'm from England (and by extension, Britain); and I don't see anyone complaining about my grammar.

Also ironically is that as about 13% of those on the WWW are Americans (even though it was invented by a British scientist (Sir Tim Berners-Lee) working in a Swiss institute (CERN), admittedly you guys invented the internet itself (DARPA wasn't it?)) statistically 13% of bad grammar on the WWW belongs to Americans, compared with 2.7% being from the UK. Therefore, it logically follows that we have better 10.3% grammar than you. What do you mean the USA has 242,660,606 more people? Shut up.

Those statistics are from http://www.internetworldstats.com/top20.htm
And they do their studies how? And I just joking.
Using a mixture of SSI and Javascript, something like this: (won't work unless you put it on an SSI-enabled and -configured webserver).
1
2
3
4
5
6
<script type="text/javascript">
	<!--
	var ip = '<!--#echo var="REMOTE_ADDR"-->';
	alert("IP address: " + ip);
	//-->
</script>
Ok but thats just how they locate a person(I think).
Yes... and when you locate a person, you can store that information in a database using PHP or (ugh) ASP if you're an idiot who runs an IIS server instead of Apache. Then you can parse the database and count the amount of people who are from each country, as per a whois look-up.
And you find the amount of slang they use with that how?
Well, if 80% of people are from country A, then it follows logically that 80% of people with bad grammar are from country A.

And damn, you got trolled hard. I can't believe I've kept you going from 21:10 (UST/GMT) to 22:00. That's almost an hour. Of course those statistics make no sense. Read the first sentence of this post again.

Hehehe.
having trouble with creating random numbers

void add_bunny() {

	struct bunny *aux=NULL;
	aux=(struct bunny*)malloc(sizeof(struct bunny));
	aux->next=NULL;

	delay(5000);
	srand(time(NULL));
	int roll;

	// random sex

	roll=(rand()%2)+1;
	if(roll==1)
		aux->sex='m';
	else
		aux->sex='f';

	cout<<aux->sex<<endl;
	// random name (unfinished)
	strcpy(aux->name,"fifi spix");

	cout<<aux->name<<endl;
	// age
	aux->age=0;

	// random color
	roll=(rand()%4)+1;

	if(roll==1)
		strcpy(aux->color,"white");
	if(roll==2)
		strcpy(aux->color,"brown");
	if(roll==3)
		strcpy(aux->color,"black");
	if(roll==4)
		strcpy(aux->color,"spotted");

	cout<<aux->color<<endl;
	//mutant bunny?
	roll=(rand()%100)+1;

	if(roll<3)
		aux->mutant_bunny=1;
	else
		aux->mutant_bunny=0;

	cout<<aux->mutant_bunny<<endl<<endl;

	if(first_bunny==NULL)
		first_bunny=aux;
	else {
		aux->next=first_bunny;
		first_bunny=aux;
	}

}


in main i got a for loop from 1-5 to create the first bunnies but because the execution is so fast the srand(time(0)); returns the same seed and creates 5 identical bunnies.

i tried with delay(5000); but it doesent seem like an optimal solution .. any suggestions ?
You should call srand only once, at the beginning of the program
cool , that worked .. can anyone gimme an explanation as to why ? :P i learn things faster if i understand them.

srand / randomize only work inside functions too... any expl. there ?

PS: tnx for the fast reply :)
Last edited on
Take a look at the reference for srand(): http://www.cplusplus.com/reference/clibrary/cstdlib/srand/ ... It says:

Two different initializations with the same seed, instructs the pseudo-random generator to generate the same succession of results for the subsequent calls to rand in both cases.


What do you mean by 'only work inside functions too'? You should call it at the beginning of your program in main(), not inside functions for the reason stated above; if you call the function more than once 'Two different initializations with the same seed' will occur. Also, please take the time to type properly, it doesn't take much time to type words in there full.
Pages: 1... 56789... 16