Hi! I'm trying to write a program that capitalizes every other word of a user output. (ex: if input is "i love you", the output is "i LoVe YoU").
I am using a for loop (although an if loop might be easier?) and I'm assuming that it is possible to write this program using a for loop (although I may be wrong--maybe only if loops can write this program). I have everything down EXCEPT the last step where I have to print the entire sequence.
What i have so far is:
// get user input
printf("Type a sentence: ");
string s = GetString();
// make every other letter capital
if (s != NULL)
for (int i = 1, n = strlen(s); i < n; i +=2)
new = (((int) s[i]) - 32);
The code above basically only prints out the capital letter (ex: input is "hello", output is "EL").
I have been thinking and thinking about this problem, but I don't know how to print out the entire sequence. What am I missing? Thank you.