Thursday

C++ Syntax error: no match for 'operator=' (operand types are 'std::__cxx11::string' {aka 'std::__cxx11::basic_string'} and '') (solved)

Program:

#include <iostream>
using namespace std;

int main()
{
    srand(123);

    int vertices = 10;

    string A[vertices][vertices];

    for ( int i = 0; i < vertices; ++i )
    {
        for ( int j = 0; j < vertices; ++j )
        {
            A[i][j] = to_string{ rand()%100+1 };
        }
    }

    return 0;
}

Solution: Change braces { .. } to parentheses ( .. )

No comments:

If a hater attacked your age and not the goodness of you

Whether young or old, I've always been known what endures. I've known the very idea of people that were all created equal and deserv...