wtorek, 22 listopada 2022

wektory, dwa kody

 #include <iostream>

//natalia marciak

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

using namespace std;

int main(int argc, char** argv) {

int u[2],v[2];

cout <<"podaj wspolrzedne pierwszego wektora  "<<endl;

cin >>u[0]>>u[1];

cout <<"podaj wspolrzedne drugiego wektora  " <<endl;

cin >>v[0]>>v[1];

cout <<"u["<<u[0]<<"," <<u[1]<<"]" <<endl;

cout <<"v["<<v[0]<<"," <<v[1]<<"]" <<endl;

cout <<"u+v=["<<u[0]+v[0]<<"," <<u[1]+v[1]<<"]"<<endl;

cout <<"u-v=["<<u[0]-v[0]<<"," <<u[1]-v[1]<<"]"<<endl;

cout <<"u*v=["<<u[0]*v[0]<<"," <<u[1]*v[1]<<"]"<<endl;

float a;

cout << "podaj a";

cin>>a;

cout <<"a*v=["<<a*v[0]<<"," <<a*v[1]<<"]"<<endl;



return 0;

}










#include <iostream>

//natalia marciak

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

using namespace std;

int main(int argc, char** argv) {

int u[2],v[2];

cout <<"podaj wspolrzedne pierwszego wektora  "<<endl;

cin >>u[0]>>u[1];

cout <<"podaj wspolrzedne drugiego wektora  " <<endl;

cin >>v[0]>>v[1];

cout <<"u["<<u[0]<<"," <<u[1]<<"]" <<endl;

cout <<"v["<<v[0]<<"," <<v[1]<<"]" <<endl;

cout <<"u+v=["<<u[0]+v[0]<<"," <<u[1]+v[1]<<"]"<<endl;

cout <<"u-v=["<<u[0]-v[0]<<"," <<u[1]-v[1]<<"]"<<endl;

cout <<"u*v="<<u[0]*v[0]+ u[1]*v[1]<<endl;

if (u[0]*v[0]+u[1]*v[1]==0)

cout <<"Wektory sa prostopadle  " <<endl;

else

cout <<"Wektory nie sa prostopadle";




return 0;

}

strona www

 file:///C:/Users/Ucze%C5%84/Desktop/index.html