Koing
Elite Member <br> Super Moderator<br> Health and F
I read this guy wants this done. This interested me and I thought of how I'd go about doing it.
This is what he wants done:
1. Read In from Keyboard a person's first, middle and last name, all in a single input with spaces. (e.g, John Fitzgerald Kennedy)
2. Print out
a. Last name, First and middle (eg, Kennedy, John Fitzgerald)
b. Persons intials in order (JFK)
c. number of leters in each of there names
d. Name that contains the most leters, if a tie is formed then print "tie"
Now I don't actually want you guys to write it out for him. I want to know if my idea of doing it was right or wrong.
Well here is my idea of how I'd do it:
1. Read In from Keyboard a person's first, middle and last name, all in a single input with spaces. (e.g, John Fitzgerald Kennedy)
Store as a strong and with the gaps as they are important to help out the rest
2. Print out
a. Last name, First and middle (eg, Kennedy, John Fitzgerald)
Get the code to read past the 2nd space and to print that out first and print the string as normal looping back to print the first and middle.
b. Persons intials in order (JFK)
Print the first letter after the space apart from the first name which just prints the first letter of the string.
c. number of letters in each of there names
Count the length of the string until it reach's a space then restart the count storing the previous number in a variable to compare later.
d. Name that contains the most leters, if a tie is formed then print "tie"
Print the variable that has stored the number of letters in. Compare them and print the biggest one. If tie print tie.
Just trying to improve my programming skills and thinking in programming.
Thanks.
Koing
This is what he wants done:
1. Read In from Keyboard a person's first, middle and last name, all in a single input with spaces. (e.g, John Fitzgerald Kennedy)
2. Print out
a. Last name, First and middle (eg, Kennedy, John Fitzgerald)
b. Persons intials in order (JFK)
c. number of leters in each of there names
d. Name that contains the most leters, if a tie is formed then print "tie"
Now I don't actually want you guys to write it out for him. I want to know if my idea of doing it was right or wrong.
Well here is my idea of how I'd do it:
1. Read In from Keyboard a person's first, middle and last name, all in a single input with spaces. (e.g, John Fitzgerald Kennedy)
Store as a strong and with the gaps as they are important to help out the rest
2. Print out
a. Last name, First and middle (eg, Kennedy, John Fitzgerald)
Get the code to read past the 2nd space and to print that out first and print the string as normal looping back to print the first and middle.
b. Persons intials in order (JFK)
Print the first letter after the space apart from the first name which just prints the first letter of the string.
c. number of letters in each of there names
Count the length of the string until it reach's a space then restart the count storing the previous number in a variable to compare later.
d. Name that contains the most leters, if a tie is formed then print "tie"
Print the variable that has stored the number of letters in. Compare them and print the biggest one. If tie print tie.
Just trying to improve my programming skills and thinking in programming.
Thanks.
Koing