I've been trying to program Hangman in QBasic, and I can't get the Left$ command to work.
Here's the algorithm I'm trying to use to split the string's letters up into different variables:
numl=len(string$)
for i = 1 to numl
letter=left$(string$, i)
next i
The error it gives me says "Data type conflict error"
Help with Left$ command
Moderators:Administrator, Global Moderator
How has the array "letter" been declared.
The left$ function returns a string typed variable.
In this statement:
t$=left$(work$,3)
If work$= "This is a test." , then t$ will be set to "Thi".
For your project, you'd probably want to use the mid$ function.
dim letter( 1 to 30) as string *1
numl=len(string$)
for i = 1 to numl
letter(i)=mid$(string$, i,1)
next i
The left$ function returns a string typed variable.
In this statement:
t$=left$(work$,3)
If work$= "This is a test." , then t$ will be set to "Thi".
For your project, you'd probably want to use the mid$ function.
dim letter( 1 to 30) as string *1
numl=len(string$)
for i = 1 to numl
letter(i)=mid$(string$, i,1)
next i
Hey, great thread
1) Question was asked in an intelligent, complete way.
2) Answer was excellent
3) OP came back and said "Thanks"
This is the way all threads should be. But I dream on.
Mac (The old QBasic Forum of Mallard)
http://www.network54.com/Index/10167
1) Question was asked in an intelligent, complete way.
2) Answer was excellent
3) OP came back and said "Thanks"
This is the way all threads should be. But I dream on.
Mac (The old QBasic Forum of Mallard)
http://www.network54.com/Index/10167
Mac
The QBasic Forum
http://www.network54.com/Forum/13959
The QBasic Forum
http://www.network54.com/Forum/13959