What is the difference between the sun and the moon?

  • Thread starter Kenny McCormack
  • Start date
M

Mike Wahler

Kenny McCormack said:
Please help. Send answer to (e-mail address removed)


#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


ptrdiff_t sval(const char *s)
{
const char a[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";

size_t v = 0;
const char *f = 0;

while(*s)

if(f = strchr(a, *s++))
v += f - a + 1;

return v;
}

size_t diff(const char *s1, const char *s2)
{
return (ptrdiff_t)fabs(sval(s1) - sval(s2));
}

int main()
{
const char comp1[] = "the sun";
const char comp2[] = "the moon";

printf("The difference betweeen %s and %s is %lu\n",
comp1, comp2, (unsigned long)diff(comp1, comp2));

return 0;
}


-Mike
 
K

Kenneth Brody

Kenny McCormack wrote in the subject line:
What is the difference between the sun and the moon?

One is purple and the other is salty.

--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody | www.hvcomputer.com | |
| kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <mailto:[email protected]>
 
A

Alexei A. Frounze

Kenny McCormack said:
Please help. Send answer to (e-mail address removed)

Unless you're disabled and cannot see or sense, there's half a dozen of
properties that you should be able to list yourself.

Alex
 
K

Keith Thompson

Alexei A. Frounze said:
Unless you're disabled and cannot see or sense, there's half a dozen of
properties that you should be able to list yourself.

Alex

Please do not feed the troll. (The fact that he's trying to make fun
of trolls may or may not make him less of a troll himself, but at the
very least don't take him seriously.)
 
O

Old Wolf

Alexei said:
Unless you're disabled and cannot see or sense, there's half a dozen of
properties that you should be able to list yourself.

Well, I learned a new word from all this: syzygy (among
other things: when 3 bodies are lined up, esp. the Sun, Earth and Moon).
 
K

Kenny McCormack

Please do not feed the troll. (The fact that he's trying to make fun
of trolls may or may not make him less of a troll himself, but at the
very least don't take him seriously.)

Yes. Listen to the man. Him speakum truth.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top