Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main () {
- int wybor;
- cout << "1)podawanie punktow" << endl;
- int a;
- int p1, p2;
- ofstream output( "obrazek.eps" );
- cin >> wybor;
- switch(wybor) {
- case 1:
- int x, y, z;
- cout << "Podaj rozmiar grafu" << endl;
- cin >> y;
- cin >> x;
- output << "%!PS-Adobe-3.0 EPSF-3.0";
- output << "%%BoundingBox: 0 0 " << y << " " << x << endl;
- cout << "Podaj grubosc lini" << endl;
- cin >> z;
- output << z << " setlinewidth" << endl;
- //
- output << "%" << endl;
- output << "% Set RGb line color." << endl;
- output << "%" << endl;
- output << " 0.0200 0.0000 0.0200 setrgbcolor" << endl;
- output << "%" << endl;
- output << "% Set RGb line color." << endl;
- output << "%" << endl;
- output << " 0.5000 0.5000 0.5000 setrgbcolor" << endl;
- output << "%" << endl;
- output << " /Helvetica findfont 20 scalefont setfont" << endl;
- cout << "Ile punktow chcesz zmiescic na grafie?" << endl;
- cin >> a;
- int start1, start2;
- for ( int i = 0 ; i < a ; i++ ) {
- cout << "Podaj wspolrzedne punktu " << i+1 << endl;
- cin >> p1 >> p2;
- if ( i == 0 ) {
- output << p1 << " " << p2 << " moveto" << '\n'
- << p1 << " " << p2 << " 10 0 360 arc closepath fill" <<endl;
- start1 = p1;
- start2 = p2;
- } else {
- output << p1 << " " << p2 << " 10 0 360 arc closepath fill" << endl;
- }
- }
- for ( int i = 0 ; i < a ; i++ ) {
- cout << "Podaj wspolrzedne punktu " << i+1 << endl;
- cin >> p1 >> p2;
- if ( i == 0 ) {
- output << p1 << " " << p2 << " moveto" << endl;
- start1 = p1;
- start2 = p2;
- } else {
- output << p1 << " " << p2 << " lineto" << endl;
- }
- }
- output << start1 << " " << start2 << " closepath" << endl;
- output << "stroke " << endl;
- int tekst1, tekst2;
- cout << "Podaj wspolrzedne tekstu " << endl;
- cin >> tekst1 >> tekst2;
- output << " " << tekst1 << " " << tekst2 << " moveto" <<'\n'
- << "(GRAF GENERATOR) show" << endl;
- break;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement