\clearpage
\subsection{C++ Literal} % (fold)
\label{sub:program-creation-c_literal}

A literal is either a number or text value written directly in the code. In other words, it is not \emph{calculated} when the program runs - the value entered is \textbf{literally} the value to be used. Figure \ref{csynt:program-creation-literal} shows the syntax for the different literal values you can enter into your C++ code.

\csyntax{csynt:program-creation-literal}{Literals}{program-creation/literal}

\mynote{
\begin{itemize}
  \item Most of these are self evident. For example, a whole number can be \csnipet{127}, \csnipet{-8711}, \csnipet{+10} for example. Real numbers are written as \csnipet{3.1415} for example.
  \item Within a string the {\textbackslash} character is used to indicate that the next character has a special meaning. The following list includes the most useful special characters:
  \begin{itemize}
    \item \texttt{{\textbackslash}n} creates a new line
    \item \texttt{{\textbackslash}"} creates a double quote
    \item \texttt{{\textbackslash}\%} creates a \% character
    \item \texttt{{\textbackslash}{\textbackslash}} creates a {\textbackslash}
  \end{itemize}
  % \item `0..9' means the digits 0, 1, 2, etc. up to 9.
  % \item `\emph{any character except ", {\textbackslash}, \%, or new line}' allows you to include any character, with those that can not be includes directly being able to be included using the escape sequence (e.g. {\textbackslash}n for new line).
\end{itemize}
}

% subsection c_literal (end)