CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2013
    Posts
    10

    suggest one loop logic for concatenating two strings without strcat

    I have written a program which concatenate two strings without the help of strcat.
    I have used two loops to make this logic.
    But want to make the logic with one loop kindly review my code c++ program to concatenate two strings without using strcat and share your logic in comments section of blog so every visitor can read blog and your's code and compare both.
    Thanks
    Blogging at C++ programming for beginners to help students

  2. #2
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,923

    Re: suggest one loop logic for concatenating two strings without strcat

    If you would like comments re the code, then you should post it within this thread rather than providing a link.

    PS There are several issues with that code.
    Last edited by 2kaud; October 23rd, 2015 at 01:52 PM.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    Join Date
    Oct 2013
    Posts
    10

    Re: suggest one loop logic for concatenating two strings without strcat

    Can you list down few of them?
    Blogging at C++ programming for beginners to help students

  4. #4
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,923

    Re: suggest one loop logic for concatenating two strings without strcat

    Quote Originally Posted by fahadmunir32 View Post
    Can you list down few of them?
    Yes if you post the code on this forum. Then I'll reply here.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  5. #5
    Join Date
    Jun 2015
    Posts
    208

    Re: suggest one loop logic for concatenating two strings without strcat

    Quote Originally Posted by fahadmunir32 View Post
    But want to make the logic with one loop kindly review my code
    I can tell without even reviewing your code.

    Introduce a function that copies a string from one location to another. Then use it twice to copy each of the source strings one after the other to the target string.

    That's procedural programming in a nutshell.
    Last edited by tiliavirga; October 24th, 2015 at 10:23 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured