Concatenating digits

Page 1 of 1

2 Replies - 1159 Views - Last Post: 15 November 2009 - 08:20 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=139116&amp;s=6535d4fc5d8e57df7c177e973e68a6fe&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

#1 origami77

Reputation: 0
• Posts: 5
• Joined: 14-November 09

Concatenating digits

Posted 14 November 2009 - 10:28 PM

I want to combine numbers:
EXAMPLE:
```#include <iostream>
#include "stdafx.h"
using namespace std;

int main()
{
int x;
int y;
cout << "Enter a #" << endl;
cin >> x;
cout << "Enter a #" << endl;
cin >> y;
int xandy = //how would i make it equal (if x=3, and y=4) 34?
cout << xandy << endl; // write out 34 on the screen
}

```

origami77

This post has been edited by origami77: 14 November 2009 - 10:29 PM

Is This A Good Question/Topic? 0

Replies To: Concatenating digits

#2 janotte

• code > sword

Reputation: 990
• Posts: 5,141
• Joined: 28-September 06

Re: Concatenating digits

Posted 14 November 2009 - 10:31 PM

Cast "x" and "y" into strings then concatenate the strings.

More here
http://www.cplusplus.../string/string/

#3 freeAccount

Reputation: 0
• Posts: 1
• Joined: 15-November 09

Re: Concatenating digits

Posted 15 November 2009 - 08:20 PM

Why don't you multiply x*10 and add y to it

This post has been edited by freeAccount: 15 November 2009 - 08:22 PM