using namespace System;
Int32 main(void)
{
// Create some strings
String s1 = S"This will ";
String s2 = S"be a ";
String *s3 = S"String";
Console::WriteLine(String::Concat(s1, s2, s3));
// Create a copy, then concatenate new text
String *s4 = s2;
s4 = String::Concat(s4, S"new ");
Console::WriteLine(String::Concat(s1, s4, s3));
// Replace stuff in a concatenated string
String *s5 = String::Concat(s1, s2, s3)->Replace(S"i", S"*");
Console::WriteLine(s5);
// Insert into a string
String *s6 = s3->Insert(2, S"range St");
Console::WriteLine(String::Concat(s1, s2, s6));
// Remove text from strings
s1 = s1->Remove(4, 5); // remove from middle and overwriting
s2 = s2->Remove(0, 3); // remove from start and overwriting
Console::WriteLine(String::Concat(s1, S"is ", s2, s3));
return 0;
}
这个代码如何在VS2017运行,创建什么项目能够运行这个代码
创建控制台项目
能具体点吗,谢谢
@黑光夜中明: 参考园子里的博文:
@dudu:
@黑光夜中明: 参考 Visual Studio 下的第一个 C++ 项目
@dudu: 这个不是C++
@黑光夜中明: 上面的代码要放在 class
中