I am getting this error and i don't know what it means. this is my code, i do have header files but i didn't include them.

int main()
{
	[LIST=1]
[*]     cout<<"Welcome to guitar hero"<<endl;
[*]	cout<<"Try and press the correct letters on the line"<<endl;
[*]	cout<<"You will use the letters, Q,W,E,R,T, and 5"<<endl;
[*]	system("pause");
[*]	system("cls");

[*]	char movem[5][60];
[*]	for(int i=0;i<5;i++)
[*]	{
[*]	strcpy(movem[i],"          11                                               ");
[*]	cout<<movem[i]<<endl;
[*]	}
[*]	for(i=58;i>0;i--)
[*]	{
[*]		for(int x=0;x<5;x++);
[*]		{
[*]			cout<<movem[x]<<endl;
[*]		}
[*]		strcpy(movem[1][i],"Q");[B]//says the error is here[/B]
[*]		strcpy(movem[1][i+1]," ");
[*]	}

[*]	
[*]	return 0;
[*]}
[/LIST]

[B]The error is 
'strcpy' : cannot convert parameter 1 from 'char' to 'char *'[/B]

On line 6 movem is declared as a two dimensional array of type char meaning each movem[a] is a string and each movem[a] is a char. strcpy requires two char *s, or strings if you prefer, so passing movem as in line 9 is correct but passing movem[1], a char, on line 18 and movem[1], also a char, on line 19, won't do.

i found out the problem, i just did movem[1][i]='Q'; this removed the errors but now im getting runtime errors. i don't know what going on.

Post code, input used and expected output and maybe somebody can help you out. Runtime errors often result from buffer overflows, etc. I can't tell how long the string in line 9 is that you're trying to copy to movem, but it suspiciously longer than 59 char.

I have a run time error because of the character string. i don't know why there is an error though

[LIST=1]
[*]int main()
[*]{
[*]	int x;
[*]	int p;
[*]	cout<<"Welcome to guitar hero"<<endl;
[*]	cout<<"Try and press the correct letters on the line"<<endl;
[*]	cout<<"You will use the letters, Q,W,E,R,T, and 5"<<endl;
[*]	system("pause");
[*]	system("cls");

[*]	char movem[5][60];
[*]	for(int i=0;i<5;i++)
[*]	{
[*]	strcpy(movem[i],"          11                                               ");[B]//this is 58 characters, i counted[/B]
[*]	}
[*]	for(i=57;i>0;i--)
[*]	{
[*]		for(x=0;x<5;x++);
[*]			cout<<movem[x]<<endl;[B]//this is where it couts the whole array, sting by sting[/B]
[*]		
[*]		movem[0][i]='Q';[B]//suppose to make that index in the 2d array a Q[/B]
[*]		movem[0][i+1]=' ';[B]//suppose to make the previous place of the Q to blank space[/B]
[*]		for(p=0;p<1000000;p++)
[*]			cout<<"";
[*]		system("cls");
[*]	}

[*]	
[*]	return 0;
[*]}
[*]

[/LIST]

It is suppose to cout a Q moving across the screen but all that is shown on screen is garbage, it just shows weird symbols.

Do you need to memset() movem to null?

I'm not sure, I'm pretty much a beginner at C++. I'd compile it if it had newlines in the code tag...

im new to c++ also, and i have no idea what your talking about memset()

thanks, i found that out after playing with it for an hour.

This article has been dead for over six months. Start a new discussion instead.