what am i doing wrong?
im trying to capitalize every other word. for examples input: hello output: HeLlO
what am i doing wrong?
im trying to capitalize every other word. for examples input: hello output: HeLlO
Well, my first question to ask you is why did you not include the whole program? It looks like you use some kind of "GetString" function, but I have no idea what you do in that function( Yes I know it probably gets the string, but with what? ). Also, I doubt cs50 is a ANSI C standard preprocessor directive. The corrrect way to use it would be this :
Also, why are you using - 23? I'm guessing your trying to decrement the ASCII value perhaps, but if so, you are doing it in a not efficient way. I would suggest using toupper and tolower with a flag that controls when they change the case. That way, it would be easier to control the program the way you want it to be.Code:#include "cs50.h"
Another question, in your example output, you were capitalizing every letter not the word? Is that your desired result? The title is misleading if so.
The only difference between the <> and "" when dealing with the include directive is the order in which directories are searched. If you have a "non-standard" header in your include search path then the <> are quite acceptable. And some high profile "standards" require the use of the <> for all occasions, for example the JSF standard.Also, I doubt cs50 is a ANSI C standard preprocessor directive. The corrrect way to use it would be this :
Jim
In addition to the information provided by BatchProgrammer:
This does not change anything. You're calculating a value ... and doing nothing with it. If you wish to store it, you must assign the result somewhere.Code:s[i] - 23;
Also, in the future, please post your code in code tags, and not as an attached image.
;_;
Why do we have a picture of text?
What kind of logic drives this decision?
I wonder how many gigabytes of video tutorials exist on "Youtube" that are nothing but text dumps?
*shrug*
Anyway, I hate to ask, is this bad C or bad C++?
I know you posted in C, but the `string' thing implies C++.
[Edit]
I realize this isn't relevant to the problem at hand, but it significantly changes the help you might receive.
[/Edit]
Soma
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson