SteveCRM
Jan 3rd, 2001, 09:17 PM
why don't these plot correctly? in bold is the important code:
/*---=== C++ BALL MOVER===---
---===STEVE MACK===---*/
#include <iostream.h> //our normal i/o header
int dummy; //so the console doesn't close too early
int Y; //THE Y AXIS IN THE MATRIX
int X; //THE X AXIS IN THE MATRIX
int ballY; //The ball's Y value
int ballX; //The ball's X value
int mainLoop; //Used to call the code so many times
int plotBall(int PlotX, int PlotY); //plot function prototype
int clearScreen(); //clearScreen function prototype
int main() //the main function
{
cout<<"|||---===Welcome to BALL MOVER v0.1===---|||"<<endl; // Title stuff
cout<<"BALL MOVER was written by Steve Mack"<<endl; // author info
ballY=1; // } These 2 vars will hold the balls position
ballX=1; // }
for(mainLoop=1; mainLoop<6; mainLoop++){
clearScreen(); //this will clear our screen
plotBall(ballX,ballY);
ballX=ballX++;
ballY=ballY++;
}
cout<<endl<<"Enter Anything To Quit: "; // } This is the ending sequence
cin>>dummy;// } "Press any key to exit", KEYPRESSED, close;
return 0; // }
}
//================*************FUNCTIONS*************=====================
int plotBall(int PlotX, int PlotY){ //this function plots the ball
//THE MAIN MATRIX
int FinalDrawVar;
for(X=1; X<82; X++){ //Goes through the X axis
if(PlotX==X){
for(Y=1; Y<11; Y++){
cout<<endl; //next line
if(PlotY==Y){
for(FinalDrawVar=1; FinalDrawVar<(X--);FinalDrawVar++){
cout<<"*"; //draw the spaces
}//End FinalDrawVar loop
cout<<"O"; //draw the ball
X=NULL;
Y=NULL;
return 0;
}
}//end Y Loop
} //ends drawing the ball
} //end X axis cycle
return 0;
}
int clearScreen(){ // This function will clear the screen.
//couts 5041 spaces to clear the screen
int clearScreenCounter;
for(clearScreenCounter=1; clearScreenCounter<11; clearScreenCounter++){ //endl does what we need
cout<<endl;
}
return 0;
}
/*---=== C++ BALL MOVER===---
---===STEVE MACK===---*/
#include <iostream.h> //our normal i/o header
int dummy; //so the console doesn't close too early
int Y; //THE Y AXIS IN THE MATRIX
int X; //THE X AXIS IN THE MATRIX
int ballY; //The ball's Y value
int ballX; //The ball's X value
int mainLoop; //Used to call the code so many times
int plotBall(int PlotX, int PlotY); //plot function prototype
int clearScreen(); //clearScreen function prototype
int main() //the main function
{
cout<<"|||---===Welcome to BALL MOVER v0.1===---|||"<<endl; // Title stuff
cout<<"BALL MOVER was written by Steve Mack"<<endl; // author info
ballY=1; // } These 2 vars will hold the balls position
ballX=1; // }
for(mainLoop=1; mainLoop<6; mainLoop++){
clearScreen(); //this will clear our screen
plotBall(ballX,ballY);
ballX=ballX++;
ballY=ballY++;
}
cout<<endl<<"Enter Anything To Quit: "; // } This is the ending sequence
cin>>dummy;// } "Press any key to exit", KEYPRESSED, close;
return 0; // }
}
//================*************FUNCTIONS*************=====================
int plotBall(int PlotX, int PlotY){ //this function plots the ball
//THE MAIN MATRIX
int FinalDrawVar;
for(X=1; X<82; X++){ //Goes through the X axis
if(PlotX==X){
for(Y=1; Y<11; Y++){
cout<<endl; //next line
if(PlotY==Y){
for(FinalDrawVar=1; FinalDrawVar<(X--);FinalDrawVar++){
cout<<"*"; //draw the spaces
}//End FinalDrawVar loop
cout<<"O"; //draw the ball
X=NULL;
Y=NULL;
return 0;
}
}//end Y Loop
} //ends drawing the ball
} //end X axis cycle
return 0;
}
int clearScreen(){ // This function will clear the screen.
//couts 5041 spaces to clear the screen
int clearScreenCounter;
for(clearScreenCounter=1; clearScreenCounter<11; clearScreenCounter++){ //endl does what we need
cout<<endl;
}
return 0;
}