+ 1

Hello I have three string functions and I want to know if I'm messing up on something in c++ thanks.

As you can see theres 3 string functions and It will be great if you can try to fix them and explain why you did that. This would help me understand tremendously since they were pretty challenging for me as a beginner https://code.sololearn.com/c6UQ7L6nPvoQ/?ref=app

8th Dec 2020, 7:20 PM
boba
boba - avatar
8 Antworten
+ 1
boba I suggest you study a bit more before attempting. here, is my solution -- no explanation included, since they may not make any sense to you right now, I might be wrong. https://code.sololearn.com/cA7a8A34A24A/?ref=app
8th Dec 2020, 10:31 PM
Flash
+ 1
switchCase(): You are using the correct functions, but you only compare things, you never actually convert any letters. The logic can be translated to code in a pretty straightforward way: If letter is uppercase, make it lowercase, and vice-versa, i.e. if ( isUpper( names[ i ] ) ) { names[ i ] = toLower( names[ i ] ); } else if ( ... ) // lowercase isEmphatic(): You can't chain comparisons like that in C++. Even if you could, what would it be supposed to mean? I get what you might have been trying, but that is not how to put it in code. Counting usually involves a loop, and you'll need a counter variable, to begin with. middleWord(): Your funtion doesn't seem to resemble the task at all. You need to think of a way to find the first and second whitespace and use everything inbetween to build a new string.
8th Dec 2020, 10:34 PM
Shadow
Shadow - avatar
+ 1
Hey good idea for practice! You're in good hands 👍 I'm just adding reference link for <string> and <cctype>, two headers you'll likely need for string and char manipulation; http://www.cplusplus.com/reference/cctype/ http://www.cplusplus.com/reference/string/basic_string/
9th Dec 2020, 12:06 AM
Ipang
+ 1
Ipang i appreciate that but thats not what Im looking for.
9th Dec 2020, 6:25 AM
boba
boba - avatar
0
Shadow can you show me how you so it correctly for the first two that would be helpful.
8th Dec 2020, 11:56 PM
boba
boba - avatar
0
I just need help on how to do middle word and what is chain comparison?
9th Dec 2020, 1:39 AM
boba
boba - avatar
0
Flash I appreciate the response but as a beginner this seems to advanced for me. Pointers, std is it possible to look at both of my code and see some errors I'm trying my best to do this correctly. In a correct format.
9th Dec 2020, 1:59 AM
boba
boba - avatar
0
Examples would help my brain cant click in that fast
9th Dec 2020, 3:03 AM
boba
boba - avatar