BigMachine3 Posted February 21, 2016 at 04:06 PM Report Share #593719 Posted February 21, 2016 at 04:06 PM Bom dia!! Estou com dúvidas em centrar um texto. Eu queria que um certo texto e números fica-se da seguinte maneira, imaginando que o seguinte quadro é a tela da linha de comandos: -------------------------------------------------------------------- I I I I I abcd 120.000 s I I querty 160.000 s I I pedro 0.000 s I I ze 1000.000 s I I antonieta 80.000 s I I I I I I I -------------------------------------------------------------------- Eu ainda só aprendi a usar o gotoxy mas neste caso não sei usá-lo. Link to comment Share on other sites More sharing options...
thoga31 Posted February 21, 2016 at 10:25 PM Report Share #593723 Posted February 21, 2016 at 10:25 PM (edited) Para alinhar um texto para um total de len caracteres, tens os seguintes três métodos: const foo = 'hello world'; len = 20; PadLeft(foo, len); // alinha à esquerda PadRight(foo, len); // alinha à direita PadCenter(foo, len); // alinha ao centro Para fazeres o que queres, é uma questão de "brincares" com eles 😉 Edited February 21, 2016 at 10:26 PM by thoga31 Knowledge is free! Link to comment Share on other sites More sharing options...
BigMachine3 Posted February 21, 2016 at 10:29 PM Author Report Share #593724 Posted February 21, 2016 at 10:29 PM Muito obrigado!!!! 🙂 Link to comment Share on other sites More sharing options...
BHAMF Posted July 6, 2016 at 02:18 PM Report Share #597543 Posted July 6, 2016 at 02:18 PM (edited) Tente usar este código também: procedure CENTER(MENSAGEM : string); var TAMANHO : integer; begin TAMANHO := 40 + length(MENSAGEM) div 2; writeln(MENSAGEM:TAMANHO); end; Assim que deves usar: program ex; begin center('EXEMPLO'); end. 😄 Edited July 6, 2016 at 02:19 PM by BHAMF Brenio Hallison A.M. Filho Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now