home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 33,254 of 33,346   
   ssmile03@googlemail.com to All   
   Printing concatenated string ..   
   03 Nov 13 16:35:31   
   
   { Please limit your text to fit within 80 columns, preferably around 70,   
     so that readers don't have to scroll horizontally to read each line.   
     This article has been reformatted manually by the moderator. -mod }   
      
   All,   
      
   I have a sinerio  for given string to print as "HELP01001" or "HELP011" -   
      
   1. Initial string from left is "HELP" for first-four characters and fixed.   
   2. Another has string or int value as "01" or 1 for fifth - sixth   
   characters from left and fixed.   
   3. Final third being a string or int value as "000" or 1 for seventh -   
   ninth characters from left. This final string should be able to print   
   values from 1 - 999.   
      
   Together, I have to print as -> HELP01001  with the last three digits   
   from right being incremented when needed e.g HELP01001, HELP01002,   
   HELP01003 and so on..   
      
   A small test code I tried below for above -   
      
   --   
   #include    
   #include    
   #include    
      
   using namespace std;   
      
   int main() {   
   string id = "X1";   
   int value=23;   
   ostringstream strm;   
   strm <<"HELP"<

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca