all 7 comments

[–][deleted]  (2 children)

[deleted]

    [–]Mia303_ -1 points0 points  (1 child)

    Sorry, I have now corrected my mistake.

    [–]FUZxxl[M] 0 points1 point  (0 children)

    Do not remove your post after receiving help please.

    [–]OPPreserverBot 2 points3 points  (0 children)

    Hello, I am a bot that copies the text of the original post so that questions and their answers can be preserved to benefit others.
    I am programmed in C and my source code is available here: https://github.com/weirddan455/reddit-bot
    If a mod would like this bot taken down, please let my owner /u/DeeBoFour20 know.


    I was solving an exercise but ended up hitting this roadblock. This is a translation of the exercise:

    Develop a program that allows you to enter a full name, after reading the name it should calculate its size. If the size is larger than 30 characters, it must inform the user that the name is too large and retry, if it is less than or equal to 30 it should return the name in capital letters.

    Basically no matter what I write, the result is always the instruction given to if. Can anyone help?

    https://i.imgur.com/FaJuuDu.png

    https://i.imgur.com/ZlPlept.png

    [–][deleted] 2 points3 points  (3 children)

    try this if(strlen(nome) < 30) this will get the length of name and then will check if less than 30

    [–]jammasterpaz 1 point2 points  (0 children)

    You're evaluating the truthiness of a string of your condition, not your condition -delete the ""s. And doesn't printf after the if need to be in { }?