我应该如何从C#转换为C ++ [英] How should i convert from C# to C++
本文介绍了我应该如何从C#转换为C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以帮助我将此C#代码转换为C ++
这是C#代码:
[ CODE ]
我不知道我应该用什么代替var和新的字符串函数,所以我真的需要帮助.
Can someone maybe help me with converting this C# code into C++
Here is the C# code:
[CODE]
I dont know what should i use instead of var and instead of new string function, so i would realy need help with thath.
推荐答案
1)您只需要使用显式变量声明,而不是 var .
即int maxLines = height + depth;
而不是var maxLines...
2)根据我的观察,您正在填充字符串,您可以尝试: ^ ]作为实现此方法的示例.
1) You just need to use explicit variable declarations instead of var.
ie.int maxLines = height + depth;
instead ofvar maxLines...
2) From what I see you doing, you are padding strings, you can try: Program with Padding a string[^] as an example of how to approach this.
使用int
(或其他类型)代替var
.使用std::string
[printf()
[cout
[
Useint
(or whatever type it is) instead ofvar
. Usestd::string
[^] for strings. Useprintf()
[^], or preferably,cout
[^] instead ofConsole.Write()
. etc ...
代替var
,您可以只使用int
(在这种情况下).
new String ('' '')
可以替换为" "
.
看来您是个初学者.我希望您不要提升某些C#代码并将其作为您自己的C ++工作来传递. :(
/ravi
Instead ofvar
, you could just useint
(in this case).
new String ('' '')
can be replaced by" "
.
It seems you''re a beginner. I hope you''re not lifting some''s C# code and passing it off as your own C++ work. :(
/ravi
这篇关于我应该如何从C#转换为C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文