C++ Exercise 3. In a one-dimensional array find the number of all positive elements of the array.
Exercise 4. In a one-dimensional array find the smallest element (minimum).
Exercise 5. In a one-dimensional array find the greatest element (maximum).
Exercise 6. Write a C++ program that will prompt the user to input ten integer values. (Elements of one-dimensional array). Then find the sum of all positive elements of the array.
168
356
Ответы на вопрос:
Перед комментом " {eto ! }" вобьешь уравнения uses crt,graphabc; const t = 100; n = 5; var i,j,i1,j1,mn: integer; var alpha: real; type colortype=integer; type point = record; x, y: integer; end; type point3d = record; x, y: integer; end; const lx = -100; ly = -100; lz = -100; procedure osi; begin setpenwidth(3); line(400,0,400,800); line(0,400,800,400); line(800,0,0,800); end; function to2dx(x,y,z: integer; phi: real): integer; var x1, y1, z1: integer; begin x1 : = trunc( x * cos(phi) - y * sin(phi) ); y1 : = trunc( x * sin(phi) + y * cos(phi) ); z1 : = z; to2dx : = 400 + y1 - trunc(0.3 * x1); end; function to2dy(x,y,z: integer; phi: real): integer; var x1, y1, z1: integer; begin x : = trunc( x * cos(phi) - y * sin(phi) ); y : = trunc( x * sin(phi) + y * cos(phi) ); z1 : = z; to2dy : = 400 - z + trunc(0.4 * x); end; procedure line3d(x,y,z,x1,y1,z1: integer; phi: real); begin line(to2dx(x,y,z, phi), to2dy(x,y,z, phi), to2dx(x1,y1,z1, phi), to2dy(x1,y1,z1, phi))end; procedure lineto3d(x1,y1,z1: integer; phi: real); begin lineto(to2dx(x1,y1,z1, phi),to2dy(x1,y1,z1, phi))end; procedure moveto3d(x1,y1,z1: integer; phi: real); begin moveto(to2dx(x1,y1,z1, phi),to2dy(x1,y1,z1, phi))end; procedure drawtriangle(x1, y1, z1, x2, y2, z2, x3, y3, z3 : integer; phi: real); var triangle : array[1..3] of point; var nx, ny, nz : real; var cs, s: real; begin triangle[1].x : = to2dx(x1, y1, z1, phi); triangle[1].y : = to2dy(x1, y1, z1, phi); triangle[2].x : = to2dx(x2, y2, z2, phi); triangle[2].y : = to2dy(x2, y2, z2, phi); triangle[3].x : = to2dx(x3, y3, z3, phi); triangle[3].y : = to2dy(x3, y3, z3, phi); x1 : = x3 - x1; y1 : = y3 - y1; z3 : = z3 - z1; x2 : = x3 - x2; y2 : = y3 - y2; z3 : = z3 - z2; nx : = y1 * z2 - y2 * z1; ny : = z1 * x2 - z2 * x1; nz : = x1 * y2 - x2 * y1; try cs : = abs( (nx * lx + ny * ly + nz * lz) / sqrt(nx*nx + ny*ny + nz*nz) / sqrt(lx*lx + ly*ly + lz*lz) ); setbrushcolor(rgb(trunc(100 * cs), trunc(100 * cs), trunc(100 * ; setpencolor(rgb(trunc(100 * cs), trunc(100 * cs), trunc(100 * ; polygon(triangle, 3); except end; end; procedure draw(f: function(x,y: real): real; color1: colortype; phi: real); beginsetpenwidth(1); setpencolor(color1); for j1: =-trunc(t/n) to trunc(t/n) dobeginj: =j1*n; moveto3d(j,-t,trunc(f(j,- phi); for i1: =-trunc(t/n) to trunc(t/n) dobegini: =i1*n; lineto3d(j,i,trunc(f(j, phi); end; end; for i1: =-trunc(t/n) to trunc(t/n) dobegini: =i1*n; moveto3d(-t,i,trunc(f(-t, phi); for j1: =-trunc(t/n) to trunc(t/n) dobeginj: =j1*n; lineto3d(j,i,trunc(f(j, phi); end; end; end; function p(x,y: real): real; var a: integer; begintryp: =sin((x * x - y * y) / 2000) * 50; {eto ! }except p: =1; end; end; beginlockdrawing; setwindowheight(800); setwindowwidth(800); alpha : = 0; while true dobeginclearwindow(); draw(p, rgb(255, 0, 0), alpha); redraw; alpha : = alpha - 0.03; delay(5); end; end.
Популярно: Информатика
-
Kirill322011.08.2020 07:48
-
Dion11102.12.2020 06:56
-
алёнааепар03.10.2020 02:29
-
vikkisitoff18.04.2021 05:50
-
гогогогог19.09.2020 20:15
-
vitya12356729.08.2022 04:14
-
wifaretaba23.05.2022 04:58
-
Stella200211130.04.2020 02:45
-
Ксюша797024.04.2022 09:00
-
sveta2015w04.08.2020 23:00