dimanche 6 janvier 2019

how to modify string by using for loop?

for loop is not working to modify one string with another. code is self-explainatary. Want to put part of string s1 to string mmssin24.

     int main()
{
string s1="11.20.25";
  string mmssin24="";
    for(int i=2;i<7;i++)
    {
        int j=0;
        mmssin24[j]=s1[i];
        j++;
    }
}

Aucun commentaire:

Enregistrer un commentaire