Hi, I've only learned c++ for about 2months, I've basically learned up to arrays, two and multiple dimensions but not in-depth. Currently reading through pointers.
I've managed to achieve a similar graph to what i am supposed to have.
What I'm getting.
[IMG]http://i109.photobucket.com/albums/n79/johnz13/graph1.jpg[/IMG]
Should look like.
[IMG]http://i109.photobucket.com/albums/n79/johnz13/graph.jpg[/IMG]
Problem I am having is trying to make it smaller/similar to what its supposed to be.
I was thinking of changing the variable of x in the formula y = 3*sin(2*pi*x/8) and then using a separate variable, in this case t, as a double.
const double pi = 3.141592654;
int i, j, x, y;
//dimensions
const int row = 21;
const int col = 76;
char plot[row][col];
for (j = 20; j > -1; j--){
for (i = 1; i < col; i++){
plot[j][i] = canvasBG;
for (x = 1; x < 76; x++){
y = 3.5*sin(2*pi*x*t/8)*4;
plot[y][x] = '*';
}
cout << plot[j][i];
}
cout << endl;
}
I've also had difficulty trying to put the scale on the left and bottom side. My previous attempt only resulted in the screen scrolling down continuously.
My understanding is that row = 0 to 20 (21 is where the x-axis must be), column = 0. Then only numbers divided by 4 (allow 5 numbers to be displayed evenly) have the scale values displayed, and everything else just displays a ' '(space)/32 (ascii value).
I've been thinking of whether to use a pointer to manually input and display the scales.
I've been stuck on these 2 problems for a about 3 days now. Any suggestions?