We have to print out a circle using matrices and I'm having trouble sending the matrix to the circle function. There may be other problems though also...
Thanks!
Thanks!
//This program will accept a radius of a circle and print out said circle using a matrix #include <iostream> using namespace std; //this function fill in a matrix a circle void circle (char matrix[ ][20], int length, int radius) { int middle=(length/2); for(int y=0 ; y<length ; y++) { int asquared=(middle-y)*(middle-y); for(int x=0 ; x<length ; x++) { int bsquared= (middle-x)*(middle-x); int radiussquared= radius* radius; if((bsquared+asquared)<(radiussquared)) matrix[x][y]='*'; else matrix[x][y]='-'; cout<<matrix[x][y]<<" "; } cout<<endl; } } int main() { int radius=8; int length=20; char matrix[length][radius]; circle (matrix, length, radius); }