Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > Re: Converting ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 5 Topic 5624 of 5828
Post > Topic >>

Re: Converting Type Characters to type string

by Ludovic Brenta <ludovic@[EMAIL PROTECTED] > Mar 30, 2008 at 11:38 PM

jedivaughn writes:
> number 1 thank you so much for the fast response. But when I try your
> suggestion and use say "1234" for the input I get the number 1, a few
> spaces, and then some smiley faces. not exactly what I was hoping
> for :) .  Here's my code if that's any help.
>
> with ada.text_IO, ada.integer_text_IO;
>
> procedure integers is
>
> index : natural :=0;
> char : character;
> str : string (1..10);
>
> begin
>
>     ada.text_IO.put("Please enter a few Integers ");
>     ada.text_IO.get(char);
>
>     Index := Index + 1;
>     Str(Index) := Char;
>     ada.text_IO.put(str);
                      ^^^

Of course. Pascal said that "Str (1 .. Index)" contains the user input
as a string, not "Str" which contains exactly 10 characters no matter
how many the user typed.

> end integers;
>
> Once again thanks so much for your help
> - John

-- 
Ludovic Brenta.
 




 5 Posts in Topic:
Converting Type Characters to type string
jedivaughn <jedivaughn  2008-03-30 13:04:56 
Re: Converting Type Characters to type string
Pascal Obry <pascal@[E  2008-03-30 22:19:43 
Re: Converting Type Characters to type string
jedivaughn <jedivaughn  2008-03-30 14:08:53 
Re: Converting Type Characters to type string
"jimmaureenrogers@[E  2008-03-30 14:28:11 
Re: Converting Type Characters to type string
Ludovic Brenta <ludovi  2008-03-30 23:38:31 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 14:41:47 CDT 2008.