Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8470805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:37:21+00:00 2026-06-10T16:37:21+00:00

I was wondering if anyone could tell me how to append an integer (with

  • 0

I was wondering if anyone could tell me how to append an integer (with another integer) in C++. Basically, if I have an int with this the value 67, how would I append it with the number 4 so the integer is now 674? Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T16:37:22+00:00Added an answer on June 10, 2026 at 4:37 pm

    Multiply first by ten to the power of digit number of second and add the other .

    Example: 63 and 5

    63*10=630
    630+5 =635
    

    Example: 75 and 34

    75*100=7500
    7500+34=7534
    int i1=75;
    int i2=34;
    int dn=ceil(log10(i2+0.001));     //0.001 is for exact 10, exact 100, ...
    int i3=i1*ceil(pow(10,dn)); <---- because pow would give 99.999999(for some optimization modes)
    i3+=i2;
    

    Edit: String version needs 2 int to str conversion (which is slow) and 1 string concatenation (which is not fast) and 1 str to int conversion (which is slow). Upper conversion needs 2 additions, 1 logarithm, 2 ceilings, 1 power, 1 multiplication all of which could be done in cpu without touching main memory to get/set data for sub steps that is surely less latency then string versions. If 3-4 character strings are stored in sse registers by compiler design, then both would compete for performance. Because while one would be busy computing “power” function, other would be busy extracting string from sse and putting it necessary registers one by one and constructing on another register by starting additions and multiplications. Power(10,x) function can be traded for 10*10*10…. x times so pure math version becomes faster again.

    If it is readability you need, eq- ‘s answer is best imo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if anyone could tell me if this kind of behaviour is
I was wondering, if anyone could tell. Suggest I have an CSS at my
So i was wondering if anyone could tell me what would be the best
I was wondering if anyone could tell me about the i++ operator in C#.
I was wondering if anyone could tell me if what I'm trying to accomplish
I was wondering if anyone could tell me how to implement line 45 of
Ok so i was wondering if anyone could tell me where i am going
I was wondering if anyone could tell me what the default HTTP request timeout
I was wondering if anyone could tell me how to represent the enumeration of
I have encountered a very strange problem and I was wondering, if anyone could

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.