fork download
  1. #include<cstdio>
  2. #include<algorithm>
  3. #include<string>
  4. #include<cstring>
  5.  
  6. using namespace std;
  7.  
  8. string orig[60]{"2 of Clubs","3 of Clubs","4 of Clubs","5 of Clubs","6 of Clubs","7 of Clubs","8 of Clubs","9 of Clubs","10 of Clubs","Jack of Clubs","Queen of Clubs","King of Clubs","Ace of Clubs","2 of Diamonds","3 of Diamonds","4 of Diamonds","5 of Diamonds","6 of Diamonds","7 of Diamonds","8 of Diamonds","9 of Diamonds","10 of Diamonds","Jack of Diamonds","Queen of Diamonds","King of Diamonds","Ace of Diamonds","2 of Hearts","3 of Hearts","4 of Hearts","5 of Hearts","6 of Hearts","7 of Hearts","8 of Hearts","9 of Hearts","10 of Hearts","Jack of Hearts","Queen of Hearts","King of Hearts","Ace of Hearts","2 of Spades","3 of Spades","4 of Spades","5 of Spades","6 of Spades","7 of Spades","8 of Spades","9 of Spades","10 of Spades","Jack of Spades","Queen of Spades","Ace of Spades","King of Spades"};
  9. char curr[60][50],s[110];
  10. int shuff[110][60],vis[60],ord[110];
  11. int main()
  12. {
  13. int i,no_of_shuff,tc,j;
  14. scanf("%d",&tc);
  15.  
  16. while(tc--){
  17.  
  18. memset(shuff,0,sizeof shuff);
  19. memset(curr,0,sizeof curr);
  20. memset(ord,0,sizeof ord);
  21.  
  22. for(i=0;i<52;i++)
  23. strcpy(curr[i],orig[i].c_str());
  24.  
  25. scanf("%d",&no_of_shuff);//no of Queries
  26.  
  27. for(i=0;i<no_of_shuff;i++)//scanning K s
  28. for(j=0;j<52;j++)
  29. {scanf("%d",&shuff[i][j]);shuff[i][j]--;}
  30.  
  31. getchar();
  32. s[0]='1';
  33. int app=0;
  34. while(gets(s)&&strlen(s))
  35. {
  36. sscanf(s,"%d",&ord[app]);
  37. //printf("**%d\n",ord[i]);
  38. app++;
  39. }
  40. //printf("app=%d\n",app);
  41. for(i=0;i<app;i++){
  42.  
  43. memset(vis,0,sizeof vis);
  44.  
  45. for(j=0;j<52;j++){
  46.  
  47. if(!vis[ord[i]-1])
  48. swap(curr[ shuff[ord[i]-1] [j] ] , curr[j]);
  49. vis[j]=1;
  50. //vis[ ord[i]-1 ]=1;
  51. }
  52. }
  53.  
  54. for(i=0;i<52;i++)
  55. printf("%s\n",curr[i]);
  56.  
  57. if(tc)printf("\n");
  58. }
  59. //getchar();getchar();
  60. //scanf(" ");
  61. }
  62.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:8: error: function definition does not declare parameters
prog.cpp: In function ‘int main()’:
prog.cpp:23: error: ‘orig’ was not declared in this scope
prog.cpp:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
prog.cpp:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
prog.cpp:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_move.h: In function ‘void std::swap(_Tp&, _Tp&) [with _Tp = char [50]]’:
prog.cpp:48:   instantiated from here
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_move.h:85: error: array must be initialized with a brace-enclosed initializer
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_move.h:86: error: invalid array assignment
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_move.h:87: error: invalid array assignment
stdout
Standard output is empty