Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Lars actually implemented sentence case. The first character after full-stop or exclamation mark and followed by a space is left in uppercase.

Yes, and that is going to be necessary for this to be useful. Anything posted here by me at least, is "proof of concept" only.
 
The computer won't execute it? It won't compile it?

Are you saying my code won't compile, or was that something else? I have to say my favorite code in all of programing is the IF statement. I can IF my way out of any problem. IF is the ultimate coding band aid for me :)

Side note: Last week in my Pascal class I had to deal with the EOLN and EOF homework assignment where I have to hit RETURN and then CONTROL + D after I manually enter a bunch of data in to the computer. O and by the way I still hate Top Down Design. Every week he is cramming it down our throat so I know it is important. Coding is easy but understanding the TDD and how to divided that up is difficult for me. Mid Term nest week.

-Lars
 
I think subsonix was talking about Bill's code below:

Code:
while ((c = getchar()) != EOF)
{
  if (isupper(c))
    c = tolower(c);
  putchar(c);
}

In this example, the if could be seen as having no effect.

This is because the tolower function has to be able to accept any character and either return the lower-case equivalent it knows one, or the original character if it does not. So passing a lower-case character into tolower just returns the same lower-case character. Therefore the if guarding the call to tolower may have no practical effect.

But it may be an optimization, depending on the implementation of isupper and tolower. If the performance of tolower was poor when passed character which is not upper case and the performance of isupper was good, then it would be good to have the if.
 
In this example, the if could be seen as having no effect.

This is because the tolower function has to be able to accept any character and either return the lower-case equivalent it knows one, or the original character if it does not. So passing a lower-case character into tolower just returns the same lower-case character. Therefore the if guarding the call to tolower may have no practical effect.
Thanks, jiminaus. I understand.
 
I have to say my favorite code in all of programing is the IF statement. I can IF my way out of any problem. IF is the ultimate coding band aid for me :)
"IF" is you're favorite, ey, Lars. That means you're theoretician, maybe even a philosopher. :) Of course your code works correctly. But everybody knows that pondering the possible is much more fun than contemplating the actual. ;)

You've just reminded me of a song from a kid's show called The Electric Company. The first few lyrics go something like this, ""If," you're so terrific. If I'm gonna be specific. "If" is a very special word. "If" is a word that helps me dream." Excuse me, everyone, while I enjoy my very late childhood. :p

Side note: Last week in my Pascal class I had to deal with the EOLN and EOF homework assignment where I have to hit RETURN and then CONTROL + D after I manually enter a bunch of data in to the computer. O and by the way I still hate Top Down Design. Every week he is cramming it down our throat so I know it is important. Coding is easy but understanding the TDD and how to divided that up is difficult for me. Mid Term nest week.
What's wrong with TDD?
 
Top Down Design is hard for me to grasp. The instructor is making us do a top down for every project. In fact he gave us the top down this week that we need to convert to code. Trying to take an abstract idea and converting it to a process that you can convert it to code.

The other part of the class is he is moving really fast and people are getting confused. This weeks homework we have to open a file and get the data. He never covered that in class but that information was located in chapter 2 and we are on chap 7. The TA in the lab was running around like crazy helping people.

O and next week we have a mid term test.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.