# Thread: plotting a 2D tire using functions.

1. ## plotting a 2D tire using functions.

ok so heres the code i have so far but the code doesnt really do anything and I cant figure out
how to write the function to print the picture out on a rectangle space. help please.

Code:
```int smlrad,bigrad;
int line,col;
int main (){

if (col^2+line^2<=1)
printf("+");
printf("\$");
printf("+");
}

}

system("pause");
return 0;
}```

2. You are using ^ as if it's a "raised to" operator. It is not. C uses ^ to indicate logical exclusive or, which is a bitwise operation.

For "square" operations, I'd say "x * x" is the right approach. For higher powers, you may want to use a function of some sort.

--
Mats

3. The output should look like this. but alligned properly

*************
*****************
*********************
***********************
***************************
*********\$\$\$\$\$\$\$\$\$\$\$*********
********\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$********
*******\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$*******
******\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$******
******\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$******
******\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$******
******\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$******
*****\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$*****
******\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$******
*****\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$*****
*****\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$*****
*****\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$*****
*****\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$*****
*****\$\$\$\$\$\$\$\$\$\$\$\$\$\$+\$\$\$\$\$\$\$\$\$\$\$\$\$\$*****
*****\$\$\$\$\$\$\$\$\$\$\$\$\$+++\$\$\$\$\$\$\$\$\$\$\$\$\$*****
*****\$\$\$\$\$\$\$\$\$\$\$\$\$\$+\$\$\$\$\$\$\$\$\$\$\$\$\$\$*****
*****\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$*****
*****\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$*****
*****\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$*****
*****\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$*****
******\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$******
*****\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$*****
******\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$******
******\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$******
******\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$******
******\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$******
*******\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$*******
********\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$********
*********\$\$\$\$\$\$\$\$\$\$\$*********
***************************
***********************
*********************
*****************
*************

4. And what does your code produce?

--
Mats

5. This can be done via the distance formula which is essentially what has been mentioned.