The task is to create a c source code program that will name a quadrant when a given coordinate is given.

Example:
Input Coordinate Pair: 0 5.3
Positive y Axis

I just need help on how to start this. I know I have to use if else statements but I'm not sure how to work those. I was wondering if someone could help me start off? Thanks.

3 answers

It's not too hard. Think that there are only these possibilities:

Positive X, Positive Y
Positive X, Negative Y
Negative X, Positive Y
Negative X, Negative Y

and zero x and / or y

OK, so your program will output one of 5 possible answers.

You take in two numbers, call them x and y.

Let's say you're building up a string to print at end. That's not the most elegant option, but it'll do.

You don't actually need "else" statements, like:

if (x < 0) strcpy (result, "Negative X, ");
if (x > 0) strcpy (result, "Positive X, ");
if (x == 0) ....

if (y < 0) strcat (result, "Negative Y");
if (y > 0) strcat ....
if (y == 0) strcat ....

Not the most elegant program, but you should be able to make it prettier once you have it running!
Oops, I meant 6 possible answers.

While I'm here, remember strcpy puts the value into the string, and strcat appends it to the end of the string.

Remember to be sure to declare result to be a char field (more than) big enough for what you're going to put in it.
Thanks for the input. I finally got it. Yeah!