- 1
In a string, how can i separe important values in char or in different string values?
For an exemple, i have (lettre 1, lettre 2) "(T, G)". I want to output them as 2 different string values. How can i separe T and G? Thx for your help
13 odpowiedzi
+ 2
So the idea was to get letters only from this string "{T, G}" and make a string array from the letters found? is that it?
+ 2
eloufou do you mean something like this just for clarification
https://code.sololearn.com/cJM48U35WsOR/?ref=app
+ 2
eloufou
scanf is c lang whereas cin >> is cpp and is for input
+ 1
Ipang Yes
+ 1
eloufou
Have you tried? I'd like to see your tryout code so I can check what's wrong.
Please save the code as code bit, and attach its link in post Description
https://www.sololearn.com/post/75089/?ref=app
+ 1
Yes eloufou and I gave you a hint on finding vowels and need to add a counter int
+ 1
Sorry Eloufou
Fell asleep it was late when I wrote my last response.
Use a for...loop to iterate the string. You can follow BroFar's path as in the example given
Use conditionals `if` or `switch` to verify whether the character was a vowel
If it was, add the character to the result string. Otherwise, ignore the character. You can then get the result string length as vowel counter. You can evade the need of additional string and simply use a counter variable also, it's all your choice.
Happy trying, and don't hesitate to ask along the way ...
0
Ipang, i havent tried because i have no idea... like really, no idea
0
Yea but is there something simpler
0
BroFar Ipang, something like the function scanF