test2.cpp 336 B

12345678910111213141516171819202122232425262728
  1. #include<iostream>
  2. class Per {
  3. public:
  4. double score;
  5. Per(double s) { this->score = s; }
  6. Per() {}
  7. };
  8. struct KV {
  9. public:
  10. int key;
  11. int value;
  12. Per p;
  13. KV(int key, int value, Per p) :key(key), value(value), p(p) {}
  14. KV() {}
  15. };
  16. int main() {
  17. KV tmp = {
  18. 1,2,Per(6.0)
  19. };
  20. KV tmp2 = {
  21. .key = 3,
  22. .value = 2,
  23. .p = {
  24. 6
  25. }
  26. };
  27. }