Dieser algorithmische Befehl wird nicht ausgeführt

Dieser algorithmische Befehl wird nicht ausgeführt
\documentclass{article}
\usepackage{algpseudocode}
\usepackage{algorithm}
\begin{document}
\begin{algorithm}
\caption{family}
\hspace*{\algorithmicindent} \textbf{Input}\\
\hspace*{\algorithmicindent} \textbf{Output}
\begin{algorithmic}[1]
\State sing
\While dark
\State radar
\If {not found}
\State does
\ElsIf {pick}
\State case \If do
\State did
\EndIf
\EndWhile
\end{algorithmic}
\end{algorithm}
\end{document}

Antwort1

Sie haben eine Ihrer If-Anweisungen nicht geschlossen. Dieser Code funktioniert:

\documentclass{article} 
\usepackage{algpseudocode} 
\usepackage{algorithm} 

\begin{document} 
\begin{algorithm} 
\caption{family} 
\hspace*{\algorithmicindent} 

\textbf{Input}\ 
\hspace*{\algorithmicindent} 
\textbf{Output} 
\begin{algorithmic}[1] 
\State sing 
\While dark 
\State radar 
\If {not found} 
\State does 
\ElsIf {pick} 
\State case 
\If do 
\State 
did 
\EndIf 
\EndIf
\EndWhile 
\end{algorithmic} 
\end{algorithm}

\end{document}

Bitte sehen Sie sich auch anWie stellt man gute Fragen?und formatieren Sie Ihren Code, damit er leichter zu lesen ist. Ich hoffe, ich konnte helfen.

verwandte Informationen