Qbasic-Array

I need the user to enter a phrase, every letter of the phrase is to go into an array, which I would then display. The problem is that phrase would include commas and points, but when I type a comma, I get a "redo from start". How can I allow the user to enter commas into the phrase.

Comments

: I need the user to enter a phrase, every letter of the phrase is to go into an array, which I would then display. The problem is that phrase would include commas and points, but when I type a comma, I get a "redo from start". How can I allow the user to enter commas into the phrase.: : This is what I have:: : INPUT "Enter a phrase: ", Phrase$: PRINT: Length = LEN(Phrase$): PRINT Length: DIM Word$(1 TO Length): FOR Count = 1 TO Length: Letter$ = MID$(Phrase$, Count, 1): Word$(Count) = Letter$: PRINT Word$(Count);: NEXT Count: : The answer to your question is very simple. I, too had this problem once before when I was 12. Just do this:

[code]LINE INPUT "Enter a phrase: ";Phrase$[/code]

LINE INPUT will allow the user to enter any punctuation or symbols. However, LINE INPUT will never prompt the user with a question mark as does INPUT. So, if you're asking the user a question, you must insert the question mark.: :

: : I need the user to enter a phrase, every letter of the phrase is to go into an array, which I would then display. The problem is that phrase would include commas and points, but when I type a comma, I get a "redo from start". How can I allow the user to enter commas into the phrase.: : : : This is what I have:: : : : INPUT "Enter a phrase: ", Phrase$: : PRINT: : Length = LEN(Phrase$): : PRINT Length: : DIM Word$(1 TO Length): : FOR Count = 1 TO Length: : Letter$ = MID$(Phrase$, Count, 1): : Word$(Count) = Letter$: : PRINT Word$(Count);: : NEXT Count: : : : The answer to your question is very simple. I, too had this problem once before when I was 12. Just do this:: : [code]: LINE INPUT "Enter a phrase: ";Phrase$: [/code]: : LINE INPUT will allow the user to enter any punctuation or symbols. However, LINE INPUT will never prompt the user with a question mark as does INPUT. So, if you're asking the user a question, you must insert the question mark.--Dr. COM WIZ: : : : : :

: I need the user to enter a phrase, every letter of the phrase is to go into an array, which I would then display. The problem is that phrase would include commas and points, but when I type a comma, I get a "redo from start". How can I allow the user to enter commas into the phrase.: : This is what I have:: : INPUT "Enter a phrase: ", Phrase$: PRINT: Length = LEN(Phrase$): PRINT Length: DIM Word$(1 TO Length): FOR Count = 1 TO Length: Letter$ = MID$(Phrase$, Count, 1): Word$(Count) = Letter$: PRINT Word$(Count);: NEXT Count: : : :

What comwiz said. But, I was looking at your code and I realized that you could use a function to simulate an array of characters.(strings are arrays of characters anyways).