45.3k views
5 votes
The "origin" of the cartesian plane in math is the point where x and y are both zero. Given a variable, origin of type Point-- a structured type with two fields, x and y, both of type double, write one or two statements that make this variable's field's values consistent with the mathematical notion of "origin".

1 Answer

2 votes

Answer:

  1. #include <iostream>
  2. using namespace std;
  3. struct Point{
  4. double x;
  5. double y;
  6. };
  7. int main()
  8. {
  9. Point origin;
  10. origin.x = 0;
  11. origin.y = 0;
  12. return 0;
  13. }

Step-by-step explanation:

The solution code is written in C++.

Firstly, we create a data structure Point with two fields, x and y (Line 5 -8).

In the main program, declare an origin object with Point type (Line 12).

Set the x and y fields of origin object to zero using dot syntax (Line 13-14).

User Bheinz
by
4.7k points