Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main () {
  7.  
  8. int wybor;
  9.  
  10. cout << "1)podawanie punktow" << endl;
  11.  
  12. int a;
  13. int p1, p2;
  14. ofstream output( "obrazek.eps" );
  15.  
  16. cin >> wybor;
  17.  
  18. switch(wybor) {
  19. case 1:
  20.  
  21. int x, y, z;
  22. cout << "Podaj rozmiar grafu" << endl;
  23. cin >> y;
  24. cin >> x;
  25.  
  26. output << "%!PS-Adobe-3.0 EPSF-3.0";
  27. output << "%%BoundingBox: 0 0 " << y << " " << x << endl;
  28.  
  29. cout << "Podaj grubosc lini" << endl;
  30. cin >> z;
  31.  
  32. output << z << " setlinewidth" << endl;
  33. //
  34. output << "%" << endl;
  35. output << "% Set RGb line color." << endl;
  36. output << "%" << endl;
  37. output << " 0.0200 0.0000 0.0200 setrgbcolor" << endl;
  38. output << "%" << endl;
  39. output << "% Set RGb line color." << endl;
  40. output << "%" << endl;
  41. output << " 0.5000 0.5000 0.5000 setrgbcolor" << endl;
  42. output << "%" << endl;
  43. output << " /Helvetica findfont 20 scalefont setfont" << endl;
  44. cout << "Ile punktow chcesz zmiescic na grafie?" << endl;
  45. cin >> a;
  46.  
  47. int start1, start2;
  48. for ( int i = 0 ; i < a ; i++ ) {
  49. cout << "Podaj wspolrzedne punktu " << i+1 << endl;
  50. cin >> p1 >> p2;
  51. if ( i == 0 ) {
  52. output << p1 << " " << p2 << " moveto" << '\n'
  53. << p1 << " " << p2 << " 10 0 360 arc closepath fill" <<endl;
  54. start1 = p1;
  55. start2 = p2;
  56. } else {
  57. output << p1 << " " << p2 << " 10 0 360 arc closepath fill" << endl;
  58. }
  59. }
  60. for ( int i = 0 ; i < a ; i++ ) {
  61. cout << "Podaj wspolrzedne punktu " << i+1 << endl;
  62. cin >> p1 >> p2;
  63. if ( i == 0 ) {
  64. output << p1 << " " << p2 << " moveto" << endl;
  65. start1 = p1;
  66. start2 = p2;
  67. } else {
  68. output << p1 << " " << p2 << " lineto" << endl;
  69. }
  70. }
  71. output << start1 << " " << start2 << " closepath" << endl;
  72. output << "stroke " << endl;
  73. int tekst1, tekst2;
  74. cout << "Podaj wspolrzedne tekstu " << endl;
  75. cin >> tekst1 >> tekst2;
  76. output << " " << tekst1 << " " << tekst2 << " moveto" <<'\n'
  77. << "(GRAF GENERATOR) show" << endl;
  78.  
  79. break;
  80. }
  81.  
  82. return 0;
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement