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++
#include <stdlib.h> //required for user to exit program
#include <math.h> //needed to apply maths such as sin, cos etc.
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
printf("\nPlease enter your choice:\t");
scanf("%d", &option); printf("\n");
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");
else printf ("You have entered an incorrect value, please enter a number from the menu only.\n");// Tells user if wrong number entered