lcd.print two array values separated by text

I am trying to print to an LCD an element of an integer array followed by a "/" followed by another element of the same integer array. I can do it using 3 lines of code but it seems a little brute force. I'm trying to do it in one line but not having much success. I thought I could use a concatenate string function but it did not work. It compiles but does not print anything to the lcd.
Any suggestions would be helpful as I am new to Arduinos.

Dave E

#include <LiquidCrystal.h>
LiquidCrystal lcd ( 8, 9, 4, 5, 6, 7);
int myAVals[3] = {15,5};//initiate a 2 element array

void setup ()
{ 
  Serial.begin(9600);
  lcd.begin(16,2);
  lcd.setCursor(0,0);
  lcd.print("Array print test");
  lcd.setCursor(0,1);
  lcd.print(myAVals[0]);//print the first array element
  lcd.print("/");//print the /
  lcd.print(myAVals[1]);//print the second array element
  //the above code works
  lcd.setCursor(9,1);
  lcd.print(myAVals[0]+"/"+myAVals[1]);
  //the above code does not work
  }
  
  void loop ()
 {}

Delta_G:
Check out printf.

I think you meant sprintf.

To be honest, in embedded (and most likely everywhere else) the efficiency of the code is the most important thing.

To be honest, in embedded (and most likely everywhere else) the efficiency of the code is the most important thing.

Far more important than the fact that it takes three calls to transfer three different values to the LCD.

bubulindo:
To be honest, in embedded (and most likely everywhere else) the efficiency of the code is the most important thing.

Actually that is a bit of an overstatement.
What is most important is does the code do what is needed.
If it does, then how efficient it is really doesn't matter.

If it was all about efficiency, then for sure Arduino and the Arduino IDE would not
be a rational choice to begin with.

daveE,
If you want a printf() capability to output to the lcd, then you can use this header file. (zip attached)
Simply include lcdPrintf.h just after you include LiquidCrystal.h and then make sure
you name your LiquidCrystal object "lcd", which you have.
Now you can call Printf() or lcdPrintf() and use all the printf formatting strings to
send output to your lcd.

This code will also automagically push the formatting strings into program space
so you don't have to mess with the goofy F() macro stuff to avoid burning up precious SRAM
for your formatting strings.

Be aware that the xxprintf() code cannot display floating point values (because IDE does not allow setting linker options)
and it costs about 1.6k of code for all the format control capabilities.
If the formating is simple, then while ugly and painful, it can be quite a bit smaller to use
the Arduino core code Print class functions.

--- bill

lcdPrintf.h.zip (825 Bytes)