这个程序哪里错了呢?
题目是:定义一个结构体变量(包括数值和花色),编程加52张扑克牌赋值,并将13张黑桃输出显示:下面是我写的:
#include<iostream.h>
#include<string.h>
class puke
{
char huase[20];
char shuzhi[20];
public:
void shuru(int n);
void shuchu(int n);
}puke[52];
void puke::shuru(int n)
{
switch(n%4)
{case 0:strcmp(huase,"hongtao");break;
case 1:strcmp(huase,"heitao");break;
case 2:strcmp(huase,"meihua");break;
case 3:strcmp(huase,"caohua");break;
}
switch(n/4)
{case 0:strcmp(shuzhi,"3");break;
case 1:strcmp(shuzhi,"3");break;
case 2:strcmp(shuzhi,"3");break;
case 3:strcmp(shuzhi,"3");break;
case 4:strcmp(shuzhi,"3");break;
case 5:strcmp(shuzhi,"3");break;
case 6:strcmp(shuzhi,"3");break;
case 7:strcmp(shuzhi,"3");break;
case 8:strcmp(shuzhi,"3");break;
case 9:strcmp(shuzhi,"3");break;
case 10:strcmp(shuzhi,"3");break;
case 11:strcmp(shuzhi,"3");break;
case 12:strcmp(shuzhi,"3");break;
}
}
void puke::shuchu(int n)
{
if(!strcmp(huase,"heitao"))
cout<<"huase"<<shuzhi<<endl;
}
void main()
{
int i;
for(i=0;i<52;i++)
puke[i].shuru(i);
for(i=0;i<52;i++)
puke[i].shuchu(i);
}
就是不晓得哪里错了?
还有一个问题,VC里面怎么没有cstring.h这个头文件呢?