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

Stephen23
Stephen23 2021년 5월 4일
편집: Stephen23 2021년 5월 4일
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 2021년 5월 6일
(Answers Dev) Restored edit

댓글을 달려면 로그인하십시오.

답변 (1개)

Jonas
Jonas 2021년 5월 2일

0 개 추천

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

제품

질문:

DP
2021년 5월 2일

댓글:

2021년 5월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by