473,385 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to joint 2 int?

13
Hi,

e.g.
int a = 20;
int b = 12;

I want to joint a and b together to get 2012.
Anybody know how to do it?

lots of help,
ken js
Aug 28 '07 #1
3 1428
Dreea
37
hi
if you want the return value to be an int you should do that int c=a*100+b
(c=a*10^nrDigitsInB+b)
if you want your value to be a string you should convert the numbers in string using itoa function and then concatenate then using strcat function
Expand|Select|Wrap|Line Numbers
  1. char sa[10], sb[10], sc[20];
  2. itoa(a, sa, 10); 
  3. itoa(b, sb, 10);
  4. strcpy(sc,sa); // copy the content of sa in sc
  5. strcat(sc,sb)
  6.  
Aug 28 '07 #2
Ken JS
13
Thanks a lot Dreea =)
Aug 28 '07 #3
sicarie
4,677 Expert Mod 4TB
KenJS-

This was in the Articles section, so I'm moving it over to the Forum (might get you a bit faster response in the future if you start there ;).
Aug 28 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: ericon | last post by:
Hi, my name is Conny Ericsson. I have a proposal for all List-owners,promoters and webmasters. I'm searching for partners(Sub-Associates). First, you should take a look at this...
5
by: John | last post by:
Specifically for joint tables... tblStudents tblClasses tblClasses_Students Is it be good programming to use a composite primary key in tblClasses_Students (where the key is ClassID and...
2
by: Lynnemcg1 | last post by:
Hi For a database I have been creating I have been asked to include 6 simple, 6 joint and 6 multiple queries. I'm guessing a simple query is one which includes only one table but what are the...
0
by: Lime | last post by:
Dear , i am new to php and i have few project to work on, if any one expert in php and my sql please mail me for getting work, will be paid, preference of Chandigarh people, as have to come...
4
by: nkechifesie | last post by:
I have an adodc control that is build with several tables using the select command. I need to search for a record on the adodc, is it possibles? If yes, how?
2
by: ADT_CLONE | last post by:
I am having trouble with headers at the moment. Here is the code for a start: body.h: #pragma once #ifndef BODY_H #define BODY_H
3
by: pavithrah | last post by:
how to create different source nodes with different transmission times in c++ (Linux platform)? do help us.... we are having review by next week...
3
by: sashasol | last post by:
Hello, I'm executing the following query in Oracle 9: select t1.f1, t2.f2, t3.f3 from t1, t2, t3 where t1.f3=t2.f3(+) and t2.f4=t3.f4 and t1.f1 in (date1, date2, date3) I expect to get...
2
by: xkenneth | last post by:
All, I'm in Houston/College Station/Austin quite often and I'm looking for other coders to do some joint projects with, share experiences, or do some sprints. Let me know if you're interested. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.