Difference in ascii codes

error: no matching function for call to β€˜std::vector<std::__cxx11::basic_string >::push_back(char&)’
v.push_back(s[i]);
it is showing this error

Hey @shubhangis248

You are getting this because you are trying to push a character in vector of strings

how can i correct that ?

explain your logic ,i will check the question in meanwhile :slight_smile:

The logic is that I calculate the difference in two values and to store that I used a vector and want to put string along with difference value in vector.
like for abc i got a1b1c so I tried to store this in a vector as I dont know the size

I got it ignore, u have to take char vector.

Also you cant directly push an int to character array ,so my suggestion is dont use a vector and simply print in the loop itself.

cout<<s[0];
    for(int i=0,j=i+1;i<strlen(s),j<strlen(s);i++,j++)
    {
    
        int ch1=s[i];
        int ch2=s[j];
        int k=ch2-ch1;
        cout<<k;
        cout<<s[j];
    }

Like this