How to Convert letters to underscore

I am creating a hangman script and I need help:
I need to ask player 1 to enter a word and after the word is entered I need the word to be converted to underscores depending on how many letters there are.
For example if player 1 entered: Apple
Then the command window would:
clear
clc
_ _ _ _ _
Then Player 2 would have to guess the letters/word

2 Kommentare

Stephen23
Stephen23 am 4 Mai 2021
Bearbeitet: Stephen23 am 4 Mai 2021
Original question by DP retrieved from Google Cache:
How to Convert letters to underscore
I am creating a hangman script and I need help:
I need to ask player 1 to enter a word and after the word is entered I need the word to be converted to underscores depending on how many letters there are.
For example if player 1 entered: Apple
Then the command window would:
clear
clc
_ _ _ _ _
Then Player 2 would have to guess the letters/word
Rena Berman
Rena Berman am 6 Mai 2021
(Answers Dev) Restored edit

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jonas
Jonas am 2 Mai 2021

0 Stimmen

which interpreter are you using? if you want to display an underscore eg with latex interpreter use '\_' instead of '_' .

Kategorien

Mehr zu Word games finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

DP
am 2 Mai 2021

Kommentiert:

am 6 Mai 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by