Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

how to add numbering with Alpha

example: x = PH
y = 4

how to return a
z = PH4

can I use positioning?
but what is the return value's data structure?

please help, Thank you very much

Comments

  • MeshArtistMeshArtist Member Posts: 37
    : example: x = PH
    : y = 4
    :
    : how to return a
    : z = PH4
    :
    : can I use positioning?
    : but what is the return value's data structure?
    :
    : please help, Thank you very much
    :
    :

    I may not understand your problem all too well, but are you wanting to do something like: z = x + y? If that is the case then you can use the string data type to perform concatenation. Define both x and y to be strings (string.h) and the header file includes operator overloading. The syntax would be:

    [code]
    #include
    using namespace std;

    void main()
    {
    string x = 4;
    string y = PH;
    string z = y + x;
    }
    [/code]

    Or, you can use c-style character types by using the function strcat() as follows:

    [code]
    void main()
    {
    char x[2] = "4";
    char y[3] = "PH";
    char z[2] = "";

    z = strcat(x, y);
    }
    [/code]

    I forget if strcat returns the value or merely stores it into the first parameter. This will need to be checked. Both of these methods concatenate two strings together into one. Is that what you were needing?


    --------------------------------------------
    Jordan - "MeshArtist"
    "Ever saint has a past and every sinner has a future."
    --------------------------------------------

  • Justin BibJustin Bib USAMember Posts: 0

    _____ | http://forcoder.org | free ebooks and video tutorials about < Scratch Visual Basic Java PL/SQL Python PHP Delphi C++ Visual Basic .NET C# JavaScript C MATLAB Ruby Swift Perl Objective-C R Assembly Go Lua Dart VBScript COBOL Prolog Scala Logo LabVIEW Awk Bash Scheme Crystal SAS Julia FoxPro Erlang ML Apex Clojure D Fortran Transact-SQL Hack Ada Lisp Kotlin Alice ABAP Rust F# /> __________

Sign In or Register to comment.