char字符串到int输出(数字) [英] char string to int output (numbers)

查看:362
本文介绍了char字符串到int输出(数字)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须从数字中创建一个字符串并向后打印。我知道如何从后到前打印输入,但是当我使用一串字符时,如何将数字(如1 2 3)作为输出,其中1表示不同于1时使用
一个int? 

I have to make a string from numbers and print those backwards. I know how to print an input from back to forth, but how do I get the numbers (like 1 2 3) as an output when I use a string of chars, where an 1 means something different then a 1 when you use an int? 

或者有没有办法使用带有int字符串的strcpy()en gets()?

Or is there a way to use strcpy() en gets() with an int string?

谢谢你提前!!

推荐答案

Nina,

你让它变得复杂。数字表示与电子邮件的价值。这可以是人类可见的或用于计算机。 

You make it complex. A number is a representation of a value with cyfers. This can be human visible or for the computer. 

如果是计算机,那么无论你怎么称呼它,它都是一个整数,十进制,浮点数或双精度值。  ;

If it is for the computer then it is a value likewise in an Integer, Decimal, Float or Double whatever you call it. 

如果它是针对人类的,那就是字符。每个角色都有一个代码。该代码并不总是相同,但在Windows中使用Unicode。 

If it is for humans it is in characters. Every character has a code. That code is not always the same but in Windows is used Unicode. 

然后表示小数值49,例如字符1. 

Then represent the decimal value 49 for instance the character 1. 

要将这些字符设置为值同样是.Net代码中的Int。 

To set those characters to values likewise an Int there is in .Net code. 

例如在VB 

For instance in VB 

dim x = 0

Int32.TryParse(" 123",x)

dim x = 0
Int32.TryParse("123",x)

或在C#中

var x = 0;

Int32.TryParse(" 123",out x);

var x = 0;
Int32.TryParse("123",out x);


这篇关于char字符串到int输出(数字)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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