1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

string[i] = 'A' ?

Discussion in 'C++' started by imported_danpe, Sep 4, 2010.

  1. imported_danpe

    imported_danpe New Member

    Joined:
    Sep 4, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hey i have this code in C#:

    Code:
    for (int i = 0; i < str.Length; i++)
    {
    str = (char)((int)str + 10192 + i);
    }
    and i get this error:
    Property or indexer 'string.this[int]' cannot be assigned to -- it is read only

    I wondered if its possible to do it in C++, and if it is then how? :)
     
  2. techgeek.in

    techgeek.in New Member

    Joined:
    Dec 20, 2009
    Messages:
    572
    Likes Received:
    17
    Trophy Points:
    0
    Occupation:
    EOC (exploitation of computers)..i m a Terminator.
    Location:
    Not an alien!! for sure
    Home Page:
    I think you can becoz the code has nothing wrong in it...u have reached the maximum limits of characters here while typecasting but still the characters rounded off the values by doing modulus....
     

Share This Page