|
-
October 23rd, 2015, 01:26 PM
#1
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
-
October 23rd, 2015, 01:38 PM
#2
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)
-
October 23rd, 2015, 02:10 PM
#3
Re: suggest one loop logic for concatenating two strings without strcat
Can you list down few of them?
-
October 23rd, 2015, 02:11 PM
#4
Re: suggest one loop logic for concatenating two strings without strcat
 Originally Posted by fahadmunir32
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)
-
October 24th, 2015, 01:42 AM
#5
Re: suggest one loop logic for concatenating two strings without strcat
 Originally Posted by fahadmunir32
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|