Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <ctime>
- #include <cstdlib>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- using namespace std;
- struct punkt{
- int rozmiar;
- int *tablica;
- void wprowadzenie(){
- cout<<"Podaj rozmiar przestrzeni: "<<endl;
- cin>>rozmiar;
- tablica = new int[rozmiar];
- cout<<"Wprowadz wspolrzedne: "<<endl;
- for (int i=0;i<rozmiar;i++)
- cin>> tablica[i];
- }
- void drukuj(){
- cout<<endl;
- cout<<"wspolrzedne ktore wprowadziles: "<<endl;
- for (int i=0;i<rozmiar;i++)
- cout<<" "<<tablica[i];
- }
- void przesuniecie(){
- int a,e,i=0,j=0;
- int *tab= new int[rozmiar];
- cout<<endl;
- cout<<"Podaj wektor przesuniecia: "<<endl;
- for (int j=0;j<rozmiar;j++){
- cin>>a;
- tab[j]=a;
- }
- cout<<"Nowa wspolrzedna wynosi: "<<endl;
- for(int g=0;g<rozmiar;g++){
- e=tablica[i]+tab[j];
- cout<<e<<",";
- i++;
- j++;
- }
- }
- void symetria(){
- //A'=(2a-x,2b-y), gdzie A(x,y)=(2,1)-punkt którego obraz chcesz uzyskać w symetrii względem punktu O(a,b)=(3,2) Stąd A'=(6-2, 4-1)= (4,3)
- int v,i=0,s=0;
- cout<<endl;
- cout<<"Podaj wspolrzedne punktu wzgledem ktorego wykonac symetrie: "<<endl;
- int *tab2= new int[rozmiar];
- for (int s=0;s<rozmiar;s++){cin>>tab2[s];
- }
- cout<<"Wspolrzedne punktu po symetrii: "<<endl;
- for (int l=0;l<rozmiar;l++){
- v=(2*tab2[s])-tablica[i];
- s++;
- i++;
- cout<<v<<",";
- }
- }
- };
- int main(int argc, char *argv[]) {
- punkt fuk;
- fuk.wprowadzenie();
- fuk.drukuj();
- fuk.przesuniecie();
- fuk.symetria();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment