mj_developer
پنج شنبه 07 آذر 1387, 18:34 عصر
سلام
من کدهای زیر را در ++C نوشته ام.
.................................................. ...................................
#include<conio.h>
#include<stdio.h>
#include<iostream.h>
void tower(int n,char a,char b,char c);
void main(){
tower(4,"A","B","C");
getch();
return;
}
void tower(int n,char a,char b,char c){
if(n==1){
cout<<endl<<a<<" ---> "<<c;
return;
}
tower(n-1,a,c,b);
cout<<endl<<a<<" ---> "<<c;
tower(n-1,b,a,c);
return;
}
.................................................. ...................................
اما خطای زیر رخ داده است :
error C2664: 'tower' : cannot convert parameter 2 from 'char [2]' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
.................................................. ...................................
مشکل در کجاست ؟
با تشکر...
من کدهای زیر را در ++C نوشته ام.
.................................................. ...................................
#include<conio.h>
#include<stdio.h>
#include<iostream.h>
void tower(int n,char a,char b,char c);
void main(){
tower(4,"A","B","C");
getch();
return;
}
void tower(int n,char a,char b,char c){
if(n==1){
cout<<endl<<a<<" ---> "<<c;
return;
}
tower(n-1,a,c,b);
cout<<endl<<a<<" ---> "<<c;
tower(n-1,b,a,c);
return;
}
.................................................. ...................................
اما خطای زیر رخ داده است :
error C2664: 'tower' : cannot convert parameter 2 from 'char [2]' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
.................................................. ...................................
مشکل در کجاست ؟
با تشکر...