Thread: i think this is a concatination problem?

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    7

    i think this is a concatination problem?

    alright, ive searched my c++ book through and through, but i cant friggin find the answer

    basically, i have 2 integers, and a spacer character
    ie
    int a= 1;
    int b = 2;
    char spacer = '-';

    and i want to have another var to hold all this, like this
    char whatever = '1-2';

    how the hell do i do this?

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    7
    and how do i go about clearing the screen?

  3. #3
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    screen clearing is in the FAQ.

    other problem is ........ easy...
    Code:
    #include<iostream>
    #include<sstream>
    using namespace std;
    int main()
    {
        ostringstream Output;
        int a=1,b=2;
        char spacer='-';
        Output<< a<<spacer<<b;
        cout << Output.str()<<endl;
        return 0;
    }
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM