1. ## Arrays

Hi guys, I'm at uni and I have some coursework involving a virtual line in C/C++.

The user should be able to input start and end coords (3D) of this line eg X1,Y1,Z1 and X2,Y2,Z2, and execute various transformations on the line as a whole around arbitrary points eg. rotation, translation etc.

Things is, I am stupid, and I don't even know how to set up a single 2D array to cope with this and then allow a user to modify the points in the array. I have a functioning-ish menu (see code below) but I haven't a clue about the important bits.

Could anyone please help me on how to get the array to show its six coordinates and then allow the user to modify them at least?

Thanks, Simon Phillips <spuk>

NB- can be written in C or C++

Code:
```#include <stdio.h>
#include <stdlib.h>   //required for user to exit program
#include <math.h>     //needed to apply maths such as sin, cos etc.
int main()
{
double p1[3]={0,0,0};
double p2[3]={0,0,0};

int option;

for (;;)
{
printf("--------------------\n");
printf("1| Set Start Point\n");                 //1. Sets start point of line
printf("2| Set End Point\n");                   //2. Sets end point of line
printf("3| Apply Translations\n");              //3. Translates the line by user-selected amount
printf("4| Apply Rotation\n");                  //4. Rotates the line by user-selected amount
printf("5| Apply Scaling\n");                   //5. Scales the line by user-selected amount
printf("6| Evaluate Line\n");                   //6. User selects a point along line between 0 and 1
printf("7| Exit Program\n");                    //7. Finish using program

scanf("%d", &option); printf("\n");

printf("%lf\n", p1);

if (option==1);
else if (option==2);
else if (option==3);
else if (option==4);
else if (option==5);
else if (option==6);
else if (option==7)
{
printf ("Program terminated.\n\n");
exit(1);
}
else printf ("You have entered an incorrect value, please enter a number from the menu only.\n");// Tells user if wrong number entered

}
}```

2. Press the edit button on the bottom right corner and delete this repost.

I know you did it cause Cprogramming was updating slowly and didn't realize you posted, so just go ahead and try to delete this.

3. Code:
```#include <iostream>
using namespace std;

int main()
{
const int number_of_points = 10;
const int dimensions = 3;

int points[number_of_points][dimensions] = {0};

//row 0 in the array:
points[0][0] = 10;
points[0][1] = 20;
points[0][2] = 30;

//row 1 in the array:
points[1][0] = 5;
points[1][1] = 3;
points[1][2] = 7;

return 0;
}```