Hello,
I have been dealing with the basics of programming for a long time (pascal, java, c / c ++).
One exercise bothers me.
I want to write a program where the user gives the first name.
The program checks the string of characters and determines whether you are a man or a woman.
In terms of theory, it would rather look like this:
We assume a string string name [15]
we get the name with cin stream.
When the last letter of the name is "a" in the conditional instruction, gender-female is displayed on the screen, otherwise gender-male, exception: male-male name.
And here's my question, how do I check the last character of the char string?
I know, these are the basics, as of today I am helpless ...
I am asking for tips, help.
I have been dealing with the basics of programming for a long time (pascal, java, c / c ++).
One exercise bothers me.
I want to write a program where the user gives the first name.
The program checks the string of characters and determines whether you are a man or a woman.
In terms of theory, it would rather look like this:
We assume a string string name [15]
we get the name with cin stream.
When the last letter of the name is "a" in the conditional instruction, gender-female is displayed on the screen, otherwise gender-male, exception: male-male name.
And here's my question, how do I check the last character of the char string?
I know, these are the basics, as of today I am helpless ...
I am asking for tips, help.