Sorry for posting Quiz05 until now but i totally had my mind in the Lychrel numbers(now on my blog if you want to check it) .
Quiz05, first thing to do is something related to the Lychrel, check if a word(string) its a palindrome or if its now, creating a bool function for it and printing the result.
Some new stuff on the code, like using .size and .rend, not to hard to understand them but here´s more information. There´re different ways to get the inverse of a string, the one I´ve done in the code is the easier to do in my opinion. (If you find an easier one let me know)
Palindrome:[CODE]
As you can see we´re working with a boolean expression ´cause we only need to verify if its a palindrome or its not. Instead of doing it as a bool try using int and give a 1 if ifs a palindrome or 0 if its not, both methods work perfectly. Quick doubt-solving page for you who don´t know what´s r.begin and .rend.
And here the main part of the code:
Just make a condition for the boolean expression and thats all.
3Divisibles:[CODE]
In this case, you have to create an array which contains a whole bunch of numbers that the user types and add only the ones which are divisibles by 3. Example: Range(5,3,10,6,2) from this range it only add the 3 and the 6. So it prints the total of the addition as a 9.
In my case, before giving the array a value, I ask the user for the numbers of values he will type, and thats the capacity of the array.
And just like the #WSQ10 you create a for loop to ask for all the values.
Easy to understand, I
val so it turns into the range[] value its checking, if its module with 3 its 0, then its a 3divisible and it goes to the addition(don´t forget to start all your counters in 0).
Quick Cygwin view with 5 numbers.
RANDOM PERSONAL STUFF
A guy flew a drone while there ere some fireworks on the sky and filmed it, amazing
#QUIZ05 Palindrome & 3Divisibles by dariomagana10 is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.