fork download
  1. #include<iostream>
  2. #include<array>
  3. #include<string>
  4. using namespace std;
  5.  
  6. void print_gene_table2(array < array<string,6>,22 >);
  7.  
  8. int main()
  9. {
  10.  
  11. // EXCEPTION: too many initializers for ‘std::array<std::array<std::basic_string<char>, 6ul>, 22ul>’
  12.  
  13. array < array<string,6>,22 > gene_table1
  14. {
  15. {"UUU","UUC"}, // Phe
  16. {"UUA","UUG","CUU","CUC","CUA","CUG"}, // Leu
  17. {"UCU","UCC","UCA","UCG","AGU","AGC"}, // Ser
  18. {"UAU","UAC"}, // Tyr
  19. {"UAA","UAG","UGA"}, // STO
  20. {"UGU","UGC"}, // Cys
  21. {"UGG"}, // Trp
  22. {"CCU","CCC","CCA","CCG"}, // Pro
  23. {"CAU","CAC"}, // His
  24. {"CAA","CAG"}, // Gln
  25. {"CGU","CGC","CGA","CGG"}, // Arg
  26. {"AUU","AUC","AUA"}, // Ile
  27. {"AUG"}, // STA or Met
  28. {"ACU","ACC","ACA","ACG"}, // Thr
  29. {"AAU","AAC"}, // Asn
  30. {"AAA","AAG"}, // Lys
  31. {"AGA","AGG"}, // Arg
  32. {"GUU","GUC","GUA","GUG"}, // Val
  33. {"GCU","GCC","GCA","GCG"}, // Ala
  34. {"GAU","GAC"}, // Asp
  35. {"GAA","GAG"}, // Glu
  36. {"GGU","GGC","GGA","GGG"} // Gly
  37. };
  38.  
  39. print_gene_table2(gene_table1);
  40.  
  41. return 0;
  42. }
  43.  
  44. void print_gene_table2(array < array<string,6>,22 > gene_table1)
  45. {
  46. for(unsigned i = 0;gene_table1.size();i++)
  47. for(unsigned j = 0;j < gene_table1[i].size();j++)
  48. {
  49. cout << gene_table1[i][j] << endl;
  50. }
  51. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:37:3: warning: missing braces around initializer for ‘std::array<std::array<std::basic_string<char>, 6u>, 22u>::value_type {aka std::array<std::basic_string<char>, 6u>}’ [-Wmissing-braces]
prog.cpp:37:3: warning: missing braces around initializer for ‘std::array<std::basic_string<char>, 6u>::value_type [6] {aka std::basic_string<char> [6]}’ [-Wmissing-braces]
prog.cpp:37:3: error: too many initializers for ‘std::array<std::array<std::basic_string<char>, 6u>, 22u>’
stdout
Standard output is empty