The Artima Developer Community
Sponsored Link

C# Answers Forum
input numbers, output numbers

2 replies on 1 page. Most recent reply: Feb 8, 2004 9:41 PM by Manish Singh

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Sandra

Posts: 1
Nickname: sandrapao
Registered: Jan, 2004

input numbers, output numbers Posted: Jan 22, 2004 3:50 PM
Reply to this message Reply
Advertisement
Hello,
I was wondering if someone could help me I am a bit stuck. I need to know what is the command used when the user types five consecutive numbers (76894) and the program separates the numbers by three spaces (7 6 8 9 4).
Thank you


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: input numbers, output numbers Posted: Jan 30, 2004 6:49 PM
Reply to this message Reply
What do you mean? Are you talking about console I/O? Are you saying that you want to input a string "12345" and get an array of integers [1,2,3,4,5] for example? If that's the case, all you have to do is get each character from the string individually and parse it to int.

By the way, it takes (at least) four spaces to separate 5 digits.

Manish Singh

Posts: 1
Nickname: manish01
Registered: Feb, 2004

Re: input numbers, output numbers Posted: Feb 8, 2004 9:41 PM
Reply to this message Reply
Yeah, Matt is right.

Also, has your question anything to do with Unicode strings. They take double bytes to store anything. So, when you try to print them with something which understands only ASCII results will be each character spaced by one space?

Please be clear about your question :)

Flat View: This topic has 2 replies on 1 page
Topic: display line numbers Previous Topic   Next Topic Topic: Namespace

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use