Polecenie:
Narysuj ramkę znając x1,x2,y1,y2.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma hdrstop
#pragma argsused
#include <iostream .h>
#include <stdlib>
#include <stdio>
#include <time>
#include <conio>
 
void rysuj(x1,y1,x2,y2)
{
int i,j;
for(i=0,j=0; i< =x2-x1;j++,i++)
//for(i=0;i<=x2-x1;i++)
{
gotoxy(x1+i,y1);
cout<<"*";
gotoxy(x1+i,y2);
cout<<"*";
if(j>y1)
continue;
gotoxy(x1,y1+j);
cout< <"*";
gotoxy(x2,y2-j);
cout<<"*";
}
}
 
main () {
char button;
int x1,y1,x2,y2;
system("cls");
cout<<"Rysowanie: "<<endl;
x1=4;
x2=20;
y1=5;
y2=10;
rysuj(x1,y1,x2,y2);
getchar();
}

Pozostaw odpowiedź

(c) 2007 by Michał Terbert