codice:
#include <iostream>
#include <cstdlib> // Per srand() e rand()
#include <math.h>
#include <string.h>
using namespace std;
int random_v (void)
{
int a;
a=(rand() % 13) + 1;
return a;
}
int random_s (void)
{
int b;
b=(rand() % 4) + 1;
return b;
}
int carta (void)
{
int seme,i;
char semes[6],valore[4],appoggio,stringdest[10];
seme=random_s();
switch (seme)
{
case 1:
strcpy(semes,"picche");
break;
case 2:
strcpy (semes,"cuori");
break;
case 3:
strcpy (semes,"fiori");
break;
case 4:
strcpy (semes,"quadri");
break;
}
appoggio=random_v();
switch (appoggio)
{
case 1:
strcpy(valore,"asso");
i=0;
break;
case 11:
strcpy(valore,"J");
i=0;
break;
case 12:
strcpy(valore,"Q");
i=0;
break;
case 13:
strcpy(valore,"K");
i=0;
break;
}
if (i==1)
strcpy(valore,appoggio);
strcat(valore,stringdest);
strcat (semes,stringdest);
return stringdest;
int main ()
{
char stringdest,a,b;
cout<<carta();
}
}
il compilatore mi da errore nella string
codice:
strcpy(valore,appoggio);
errore: "invalid conversion from 'char' to 'char*'
come mai?