fork download
  1. #include <fstream>
  2. #include <string>
  3.  
  4. void generateSVG() {
  5. std::ofstream svgFile("transformer_schematic.svg");
  6.  
  7. svgFile << R"(<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  8. <svg width="500" height="200" viewBox="0 0 500 200" xmlns="http://w...content-available-to-author-only...3.org/2000/svg">
  9. <!-- Основная линия -->
  10. <line x1="50" y1="100" x2="450" y2="100" stroke="black" stroke-width="2"/>
  11.  
  12. <!-- Первичная обмотка (r1) -->
  13. <line x1="100" y1="100" x2="100" y2="70" stroke="black" stroke-width="2"/>
  14. <line x1="80" y1="70" x2="120" y2="70" stroke="black" stroke-width="2"/>
  15. <text x="85" y="50" font-family="Arial" font-size="12">r1=0.0235Ω</text>
  16.  
  17. <!-- jx1 -->
  18. <line x1="150" y1="100" x2="150" y2="70" stroke="black" stroke-width="2"/>
  19. <ellipse cx="150" cy="60" rx="10" ry="10" stroke="black" stroke-width="2" fill="none"/>
  20. <text x="135" y="30" font-family="Arial" font-size="12">jx1=0.0765Ω</text>
  21.  
  22. <!-- Параллельная ветвь (r0 и x0) -->
  23. <line x1="200" y1="100" x2="200" y2="20" stroke="black" stroke-width="2"/>
  24. <!-- r0 -->
  25. <line x1="180" y1="20" x2="220" y2="20" stroke="black" stroke-width="2"/>
  26. <text x="185" y="0" font-family="Arial" font-size="12">r0=8.8Ω</text>
  27. <!-- x0 -->
  28. <ellipse cx="200" cy="40" rx="20" ry="20" stroke="black" stroke-width="2" fill="none"/>
  29. <text x="175" y="70" font-family="Arial" font-size="12">jx0=7.34Ω</text>
  30.  
  31. <!-- Вторичная обмотка -->
  32. <!-- r2' -->
  33. <line x1="250" y1="100" x2="250" y2="70" stroke="black" stroke-width="2"/>
  34. <line x1="230" y1="70" x2="270" y2="70" stroke="black" stroke-width="2"/>
  35. <text x="235" y="50" font-family="Arial" font-size="12">r2'=0.00079Ω</text>
  36.  
  37. <!-- jx2' -->
  38. <line x1="300" y1="100" x2="300" y2="70" stroke="black" stroke-width="2"/>
  39. <ellipse cx="300" cy="60" rx="10" ry="10" stroke="black" stroke-width="2" fill="none"/>
  40. <text x="285" y="30" font-family="Arial" font-size="12">jx2'=0.0765Ω</text>
  41.  
  42. <!-- Подписи -->
  43. <text x="30" y="80" font-family="Arial" font-size="14">V1</text>
  44. <text x="320" y="80" font-family="Arial" font-size="14">V2'</text>
  45. </svg>)";
  46.  
  47. svgFile.close();
  48. }
  49.  
  50. int main() {
  51. generateSVG();
  52. return 0;
  53. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Standard output is empty