转换C/C++代码到V语言


V可以将您的C/C++代码转换为人类可读的V语言代码。让我们先创建一个简单的程序 test.cpp:

#include <vector>
#include <string>
#include <iostream>

int main() {
        std::vector<std::string> s;
        s.push_back("V is ");
        s.push_back("awesome");
        std::cout << s.size() << std::endl;
        return 0;
}

运行命令 v translate test.cpp,然后V将生成文件test.v:

fn main {
        mut s := []string
    s << 'V is '
    s << 'awesome'
    println(s.len)
}

An online C/C++ to V translator is coming soon.

摘录自V语言作者Alex

results matching ""

    No results matching ""