madzik4113

sztangret I termin zadanie 1

Jan 29th, 2014
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. #include <iostream>
  2. #include <iostream>
  3. #include <conio.h>
  4. #include <string>
  5. #include <ctime>
  6. #include <cstdlib>
  7. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  8. using namespace std;
  9.  
  10. struct punkt{
  11. int rozmiar;
  12. int *tablica;
  13.  
  14. void wprowadzenie(){
  15. cout<<"Podaj rozmiar przestrzeni: "<<endl;
  16. cin>>rozmiar;
  17. tablica = new int[rozmiar];
  18. cout<<"Wprowadz wspolrzedne: "<<endl;
  19.  
  20. for (int i=0;i<rozmiar;i++)
  21. cin>> tablica[i];
  22. }
  23.  
  24. void drukuj(){
  25. cout<<endl;
  26. cout<<"wspolrzedne ktore wprowadziles: "<<endl;
  27. for (int i=0;i<rozmiar;i++)
  28. cout<<" "<<tablica[i];
  29. }
  30.  
  31. void przesuniecie(){
  32. int a,e,i=0,j=0;
  33. int *tab= new int[rozmiar];
  34.  
  35. cout<<endl;
  36. cout<<"Podaj wektor przesuniecia: "<<endl;
  37. for (int j=0;j<rozmiar;j++){
  38. cin>>a;
  39. tab[j]=a;
  40. }
  41. cout<<"Nowa wspolrzedna wynosi: "<<endl;
  42.  
  43. for(int g=0;g<rozmiar;g++){
  44. e=tablica[i]+tab[j];
  45. cout<<e<<",";
  46. i++;
  47. j++;
  48. }
  49. }
  50. void symetria(){
  51. //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)
  52. int v,i=0,s=0;
  53. cout<<endl;
  54. cout<<"Podaj wspolrzedne punktu wzgledem ktorego wykonac symetrie: "<<endl;
  55. int *tab2= new int[rozmiar];
  56. for (int s=0;s<rozmiar;s++){cin>>tab2[s];
  57. }
  58. cout<<"Wspolrzedne punktu po symetrii: "<<endl;
  59. for (int l=0;l<rozmiar;l++){
  60. v=(2*tab2[s])-tablica[i];
  61. s++;
  62. i++;
  63. cout<<v<<",";
  64. }
  65. }
  66.  
  67. };
  68.  
  69. int main(int argc, char *argv[]) {
  70. punkt fuk;
  71.  
  72. fuk.wprowadzenie();
  73. fuk.drukuj();
  74. fuk.przesuniecie();
  75. fuk.symetria();
  76. return 0;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment