pat 自测-5 Shuffling Machine

解题思路:取一个空数组,将我们原先牌的顺序按照给定的顺序放入新的数组中;因为存在多次循环,为了节省空间,所以将str1赋值给str0,这样两个数组就可以完成多次循环。

 

关于scanf报错的问题:忽略scanf的返回值的问题:第一种:可能是确实是输出不符合规定,在做
洗牌的题目中就遇到了格式不正确的问题;
//第二:怎么解决scanf的问题:if(scanf("%d",&a)){};
 

#include
#include
#include
using namespace std;
int main()
{
    string str0[]={"S1", "S2","S3","S4","S5","S6","S7","S8","S9","S10","S11","S12","S13",
                    "H1", "H2","H3","H4","H5","H6","H7","H8","H9","H10","H11","H12","H13", 
                    "C1", "C2","C3","C4","C5","C6","C7","C8&#

你可能感兴趣的:(pat 自测-5 Shuffling Machine)