I'm trying to insert a C++ code inside a LaTeX document.
As in the object, I'm trying to use accent vowels, but I'm not able to add them especially in the comment section.
Here's main.tex:
\documentclass[a4paper, 12pt, italian]{article}
\usepackage[italian]{babel}
\selectlanguage{italian}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage{xcolor}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
\lstset{style=mystyle}
\title{Casi d'uso: Prove Induttive}
\author{Luca Polese}
\date{December 2020}
\begin{document}
\maketitle
\section{Prime Prove Induttive}
\subsection{Casi semplici}
Esempio:
\lstinputlisting[language= C++]{prova1.cpp}
\end{document}
Here is prova1.cpp:
/**
* Questo esempio deve considerare il caso in cui la lista
* sia già vuota in partenza.
* Lo stessa varrebbe se cominciassi con un array pieno e mi
* ritrovassi ad un certo punto con un array vuoto, poichè
* la ricerca è fallita
*/
//PRE: (dim>=0, A[0...dim-1] è definito)
bool presente(int*A, int dim, int z){
...
}
//POST: (restituisce true sse A[0...dim-1] contiene z)
I'm using OverLeaf and the result is something like this:

As you can see, all the accented vowels are missing.
I hope you can help me
Thanks in advice.