I do a turtle graphics program and having and a hell of time with it.
Here is the code that gives me problems
void checkpos(char cmd[3])
{
int count=0;
int move[5];
char tmp'
for(int i=0;i<3;++i)
if (cmd[i]==',')
{
tmp=cmd[i+1];
move[count]=atoi(tmp);
}
}
This code gets the number of moves in the command 5,x. I am getting this error:
H:/C++_How_To_Program/chap04/Turtle_graphics/main.cpp:95: error: invalid conversion from 'char' to 'const char*'
How can I convert the [B]cha[/B]r to an[B] int [/B]and get rid fo the error ?:confused:
void checkpos(char cmd[3])
{
int count=0;
int move[5];
char tmp'
for(int i=0;i<3;++i)
if (cmd[i]==',')
{
tmp=cmd[i+1];
move[count]=atoi(tmp);
}
}
This code gets the number of moves in the command 5,x. I am getting this error:
H:/C++_How_To_Program/chap04/Turtle_graphics/main.cpp:95: error: invalid conversion from 'char' to 'const char*'
How can I convert the [B]cha[/B]r to an[B] int [/B]and get rid fo the error ?:confused:
To copy to clipboard, switch view to plain text mode
Bookmarks