how to output integers with space!

Reply

Join Date: Nov 2008
Posts: 10
Reputation: M^2 is an unknown quantity at this point 
Solved Threads: 0
M^2 M^2 is offline Offline
Newbie Poster

how to output integers with space!

 
0
  #1
Nov 23rd, 2008
helooo am new to C++ hope i will find some help here
well the question is
if the i ask the user to input an integer like
int a;
cin>>a;
and if user inputs 2345
and the output i require is 2 3 4 5 how will i do that?
is there any header file required for it?
thanks
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 1,671
Reputation: Lerner is a name known to all Lerner is a name known to all Lerner is a name known to all Lerner is a name known to all Lerner is a name known to all Lerner is a name known to all 
Solved Threads: 261
Lerner Lerner is offline Offline
Posting Virtuoso

Re: how to output integers with space!

 
0
  #2
Nov 23rd, 2008
The only header file you will need is iostream. To accomplish your task you will need to isolate the individual digits as either single digit ints or as char and then display them one at a time with as much space between them as you wish.
Klatu Barada Nikto
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 1,670
Reputation: vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold 
Solved Threads: 192
vmanes's Avatar
vmanes vmanes is offline Offline
Posting Virtuoso

Re: how to output integers with space!

 
0
  #3
Nov 23rd, 2008
And here's a tip to get you started: % /
"We Americans got so tired of being thought of as dumb by the rest of the world that we went to the polls last November and removed all doubt."
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC