The other main factor that affects the tones of a string instrument is the material that the string is made of. While in older days, strings for such instruments may have been made of many different materials, today, most strings are made of metal cord or cable. However, the metal used does vary to some degree. The metal, of course, comes in many different thicknesses. The cords also vary in the type of metal that is used to make them.
Steel is the predominate metal used for the cords.
Piano and guitar strings are very similar. The answer is acoustics. Acoustics, in this sense, is the way in which the sound from the string is affected by the instrument. For instance, the piano makes use of a hammer hitting a string while a guitar is plucked. String instruments can be very different in size, shape, and the sounds they produce, but they all use strings to make their sounds.