Home > Net >  How to implement and use vectors in C /CLI Visual Studio 2019?
How to implement and use vectors in C /CLI Visual Studio 2019?

Time:10-18

I've been trying to figure out how to implement vectors in the .Net framework with C but I keep getting errors that's saying its not able to define the vector. I'm also getting squiggly lines saying "namespace cliext has no member vector".

  #include <cliext>

  String^ toBinary(int decimal) {

    cliext::vector<String^>^ binary;

    String^ finalBinary;

    while (decimal != 1) {

        if (decimal % 2 == 1)
            binary.push_back("1");
        else {
            binary.push_back("0");

        }

        decimal /= 2;

        floor(decimal);

    }

    if (decimal == 1) binary.push_back("1");

    for (int i = 0; i < binary->Capacity; i  )
        finalBinary  = binary[i];


    return finalBinary;

}

CodePudding user response:

According to Microsoft documentation, you need to

#include <cliext/vector>
  • Related