如何在c#中替换它(scanf(“%d",& cond);) [英] how to replace this in c# ( scanf("%d",&cond);)

查看:164
本文介绍了如何在c#中替换它(scanf(“%d",& cond);)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在c#中替换它(scanf(%d",&cond);)

how to replace this in c# ( scanf("%d",&cond);)

推荐答案

此处与C#中的C代码完全相同

Here is the exact equivalent of your C code in C#

string input = Console.ReadLine();
int cond;
Int32.TryParse(input, out cond);


你好,

您是否要在Console中的C#中转换此代码?

然后
=============
Hi,

Do you want to convert this code in C# in Console

Then
==============
int cond;
object objIn=Console.In.ReadLine();
if(!Int32.TryParse(objIn,out cond))
{
 // If not a proper value
}


这篇关于如何在c#中替换它(scanf(“%d",& cond);)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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