Author |
Message |
hellzlaker Registered Cap Buster Popping men in the ass since Oct 2005
Gender: NEVER ENOUGH! Joined: Oct 27 2005 Posts: 34 Offline
|
|
Back to top |
|
|
Adam01 Novice
Joined: Oct 03 2008 Posts: 51 Offline
|
Posted: Fri Oct 31, 2008 8:46 pm Post subject: |
|
|
|
|
Hmmm...
For Pause(), You could of used getch(), it gets the next input, but doesnt output it.
This a string-to-caps function I think, there certainly is one for php.
But still, great ideas. |
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Fri Oct 31, 2008 9:08 pm Post subject: |
|
|
|
|
toupper will convert characters to their uppercase equivalent without changing things like '1' or '-'. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Sat Nov 01, 2008 1:26 am Post subject: |
|
|
|
|
As Brain said, toupper() already does that, but there are 2 things you could improve/fix in your MakeCapital function:
First, you don't need the size... A string is always ended by '\0' (a character with the value 0). So you r continuing condition can be when buf[i] != 0, or even simplier, if buf[i]. If buf[i] is non-null, evaluating "buf[i]" will return true
char* MakeCapital(char* buf)
{
for(int i=0; buf[i];++i )
buf[i]-=32;
return buf;
} |
Also, if you don't want characters that are already upper-case, or non-letter characters to be changed by this, you need to add a little if in there...
char* MakeCapital(char* buf)
{
for(int i=0; buf[i];++i )
if (buf[i] >= 'a' && buf[i] <= 'z')
buf[i]-=32;
return buf;
} |
And yeah, for pause, i think the function is 'getchar()'
Your function probably eats a shitload of CPU :/ _________________ (Insert a bunch of dead links here) |
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Sat Nov 01, 2008 8:54 am Post subject: |
|
|
|
|
toupper only converts a single char, so you'd still need a for loop like the one you've got. |
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Sat Nov 01, 2008 3:26 pm Post subject: |
|
|
|
|
Dr Brain wrote: | toupper only converts a single char, so you'd still need a for loop like the one you've got. | oh, I thought there was one for strings... There's one defined in Mervbot anyway |
|
Back to top |
|
|
|