mardi 24 septembre 2019

How to print a different symbol depending on a value?

I have been tasked to create a program that displays a - or a + depending on a value from a function.

To make it a little more clear, the output, for a few different parts, should look something like this;

07.87 |----+---
12.97 |----+----+---
02.79 |---

Essentially, every 5th symbol should be a +, where the others are -. The maximum value that could appear is 15.

So far I have this, but its not working;

if (distance(lat_2, long_2, LAT_1, LONG_1) == 5 || 10 || 15){
     printf("+");
 }
 else{
    printf("-");
 }

What am I doing wrong? If you need more information, feel free to ask.

Aucun commentaire:

Enregistrer un commentaire