我应该如何从C#转换为C ++ [英] How should i convert from C# to C++

查看:76
本文介绍了我应该如何从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 of var 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 [
Use int (or whatever type it is) instead of var. Use std::string[^] for strings. Use printf()[^], or preferably, cout[^] instead of Console.Write(). etc ...


代替var,您可以只使用int(在这种情况下).
new String ('' '')可以替换为" ".

看来您是个初学者.我希望您不要提升某些C#代码并将其作为您自己的C ++工作来传递. :(

/ravi
Instead of var, you could just use int (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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆