can anyone tell me how to write this in normal c++? thanks!
input a value to factor
while input value > 1
let residual = input value
let factor = 2
while factor <= residual
while factor divides residual
(i.e. remainder = 0)
output factor
divide residual by factor
increment factor
input next value to factor
as well as this:
open an input file named "polytest" (or "polytest.t xt")
while end of file not yet reached
input number of vertices in the polygon
assume first vertex is the origin (0,0)
input second vertex
determine vector from origin to second vertex
for each additional vertex in the data
input next vertex
determine vector from last vertex to new vertex
determine whether vector is a left or right turn
determine vector back to the origin
and whether it is a left or right turn
if all turns are left turns, or all are right turns
the polygon is convex
else the polygon is concave
input a value to factor
while input value > 1
let residual = input value
let factor = 2
while factor <= residual
while factor divides residual
(i.e. remainder = 0)
output factor
divide residual by factor
increment factor
input next value to factor
as well as this:
open an input file named "polytest" (or "polytest.t xt")
while end of file not yet reached
input number of vertices in the polygon
assume first vertex is the origin (0,0)
input second vertex
determine vector from origin to second vertex
for each additional vertex in the data
input next vertex
determine vector from last vertex to new vertex
determine whether vector is a left or right turn
determine vector back to the origin
and whether it is a left or right turn
if all turns are left turns, or all are right turns
the polygon is convex
else the polygon is concave
Comment