Originally Posted by
AndiPersti
It's probably too late, but the next time you should post your code here in the forum instead of putting it somewhere to download.
Additionally, you should only post the part you have problems with. The number of people who are willing to help you is usually inversely proportional to the number of code lines you post.
Bye, Andreas
I have time, is for today up to 12pm please help.
This is a part of my code, in the graphic.c that draw the grid
Code:
void DrawGrid(char canvas[PG_MAX_VERTICAL][PG_MAX_HORIZONTAL],int valuex,int valuey,double jumpy,double jumpx,int widthdiv,int highdiv){
int i,j;
int width=(jumpx-1)*widthdiv,high=(jumpy-1)*highdiv;
int xs,ys;
double tampasoy = valuey/(jumpy-1);
double tampasox = valuex/(jumpx-1);
double valuepointy = tampasoy/highdiv;
double valuepointy = tampasox/widthdiv;
/*left vertical enumeration*/
char buffer[30]="";
xs=0;
double enumy=0;
int maxlongbuffer=0;
for(i=high;i>=0;i--){
if((xs%highdiv)==0){
sprintf(buffer, "%.1f",enumy);
int longbuffer = strlen(buffer);
if(longbuffer>maxlongbuffer)
maxlongbuffer = longbuffer;
int ibuffer;//Counter to cycle buffer
for(ibuffer=0;ibuffer<longbuffer;ibuffer++)
canvas[i][ibuffer] = buffer[ibuffer];
enumy+=tampasoy;
}
xs++;
}
maxlongbuffer++;
/*end of left vertical enumeration*/
/*lower horizontal enumeration*/
ys=0;
double enumx=0;
for(j=maxlongbuffer ;j<(width+1+maxlongbuffer);j++){
if((ys%widthdiv)==0){
sprintf(buffer, "%.1f",enumx);
int longbuffer = strlen(buffer);
int ibuffer;
for(ibuffer=0;ibuffer<longbuffer;ibuffer++)
canvas[alto+1][ibuffer+j] = buffer[ibuffer];
enumx+=tampasox;
}
ys++;
}
/*end of lower horizontal enumeration*/
/*Making the grid*/
xs=0;ys=0;
for(i=high;i>=0;i--){
ys=0;
for(j=maxlongbuffer;j<(width+1+maxlongbuffer);j++){
if((xs%highdiv)==0){
if((ys%widthdiv)==0)
canvas[i][j]='+';
else
canvas[i][j]='-';
}
if((xs%highdiv)!=0){
if((ys%widthdiv)==0)
canvas[i][j]='|';
}
ys++;
}
xs++;
}
/*end of making the grid*/
}
And this are my declarations on the header file (.h)
Code:
#define MAX_SCREEN_AREA 100
#define PG_MAX_HORIZONTAL 80
#define PG_MAX_VERTICAL 40
#define PG_MAX_SERIES 40
I only need 2 functions that let me graph in the grid.. Like an sin function, or circle, or straight line, or parable.. I need two.. But i don't know how to do that... really.. i was trying and trying.. but nothing... Please help!!