Ultra-fast-mathematics

#include
#include
using namespace std;
int main()
{
int t;
cin>>t;
string str1;
string str2;
while(t–)
{

    cin>>str1>>str2;
    int l;
    l=str2.length();
    for(int j=0;j<l;j++)
    {
        if((str1[j]=str2[j]))
            cout<<0;
        else
            cout<<1;
    }
}

}

in this question one test case is passed but another is not why…
what problem is arrise in my code

Hi Vishal. First of all in this code u have not included the header files. Secondly when u are checking the condition (str1[j] = str2[j]) , here == is required while u used =. Thirdly u cant print using (cout<<0;) , u have to use “” marks (cout<<“0”;). and lastly endl is needed in end.


You can also refer to this code. I have made all the changes.
Hope ur doubt is cleared now.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.