编译代码没错运行起来总乱码
刚入门新手,网上找了好久解决方法都没什么结果,说是排列规则问题,新手入门求大神耐心讲解 不胜感激。#include<stdio.h>
#include<stdlib.h>
int main()
{
char card_name[3];
puts("输入牌名:");
scanf("%2s", card_name);
int val = 0;
if (card_name[0] == 'K') {
val = 10;
} else if (card_name[0] == 'Q') {
val = 10;
} else if (card_name[0] == 'J') {
val = 10;
} else if (card_name[0] == 'A') {
val = 11;
} else {
val == atoi(card_name);
}
printf("这张牌的点数是:%i\n",val);
return 0;
}