Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Vector Addition
//fpc 3.0.0 program HelloWorld; uses sysutils; type TVector3d = record x,y,z: Double; end; operator +(v1: TVector3d; v2: TVector3d) result: TVector3d; begin result.x := v1.x + v2.x; result.y := v1.y + v2.y; result.z := v1.z + v2.z; end; operator +(d: Double; s: string) result: string; begin result := FloatToStr(d) + s; end; operator +(s: string; d: Double) result: string; begin result := s + FloatToStr(d); end; operator := (v: TVector3d) result: string; begin result := '(' + v.x + ', ' + v.y + ', ' + v.z + ')'; end; var va: TVector3d = (x: 0; y: 1; z:0); vb: TVector3d = (x: 0; y: 2; z:4); begin writeln(string(va + vb)); end.
run
|
edit
|
history
|
help
0
practica 2 ejercicio 2
Huong11a2@
Different numbers in array
Huong11a2@
test27
JESSICA GOMES DE SOUZA FERREIRA 600621634
abcd...
ProcedureTest1
Sasmandar
Project Euler 18 - Maximum path sum