1704


#include<stdio.h>

#include<conio.h>

#include <iostream.h>

class wektor

{

int poz[3];

public:

wektor(int xnew, int ynew, int znew)

{

poz[0]=xnew;

poz[1]=ynew;

poz[2]=znew;

};

void przesun(int xm=0, int ym=0, int zm=0)

{

poz[0]+=xm;

poz[1]+=ym;

poz[2]+=zm;

};

void pokarz(void)

{

printf("Wektor [x,y,z] : [%d,%d,%d] \n\n", poz[0], poz[1], poz[2]);

};

};

main()

{

int a,b,c,x1,y1,z1;

printf("Podaj dowolny wektor:\nx= ");

scanf("%d",&a);

printf("y= ");

scanf("%d",&b);

printf("z= ");

scanf("%d",&c);

wektor wektorek(a,b,c);

wektorek.pokarz();

printf("Podaj wektor przesuniecia \nx= ");

scanf("%d",&x1);

printf("y= ");

scanf("%d",&y1);

printf("z= ");

scanf("%d",&z1);

wektorek.przesun(x1,y1,z1);

wektorek.pokarz();

getchar();

}



Wyszukiwarka