I need to print out a rough picture of a tire based on two radiuses. We need to include the axel (the +'s), the hub cap (the $'s), and then the tire portion (the *'s). But all I can get printed is the axel +'s portion. Any ideas on why the other's won't print out?
Code:
#include <stdio.h>
#include <math.h>
int main() {
int r1, r2, x, y;
char grid [50][50];
printf("Enter the outer radius of your wheel?\n");
scanf("%d", &r1);
printf("Enter the inner radius of your wheel?\n");
scanf("%d", &r2);
for(y = 0; y < 49; y++) {
for(x = 0; x < 49; x++) {
grid[x][y] = ' ';
}
}
for(y = 0; y < 50; y++) {
for(x = 0; x < 49; x++) {
if(x > 24 + r1 && x < 24 - r1 && y > 24 + r1 && y < 24 - r1) {
grid[x][y] = '*';
}
}
}
for(y = 0; y < 49; y++) {
for(x = 0; x < 49; x++) {
if(x > 24 + r2 && x < 24 - r2 && y > 24 + r2 && y < 24 - r2) {
grid[x][y] = '$';
}
}
}
grid[23][24] = '+', grid[24][23] = '+', grid[24][24] = '+', grid[24][25] = '+', grid[25][24] = '+';
for(y = 0; y < 49; y++) {
for(x = 0; x < 49; x++) {
printf("%c", grid[x][y]);
}
printf("\n");
}
return 0;
}