Questions tagged as 'int'

4
answers

How to convert an int to two bytes in C / C ++?

I get the data from a temperature sensor on a microcontroller that has a 10-bit AD converter. I store the data in a variable of type int (of 32 bits), and I need to send this data via serial communication. For this, I need to convert this...
asked by 03.04.2014 / 19:03
1
answer

What is the difference of Integer.valueOf () when using String or int parameters?

Why are the results of System.out different in the lines below? Integer teste = Integer.valueOf("0422"); Resultado: 422 Integer teste = Integer.valueOf(0422); Resultado: 274 If you pass a int it changes the original value, no...
asked by 17.09.2014 / 16:15
3
answers

What happens in a conversion from a char to an int?

How does it work when you get a variable and make char-48 to transform into an integer, for example in this code I made, I used a date for example "22/05/1994" stored in a char vector and turned it into day, month and year all in integer...
asked by 01.02.2014 / 22:03
1
answer

Difference between Integer.valueOf (String) and Integer.parseInt (String)

I need to convert a String to int , and I came across these two options, which have an equal result. Is there any difference between them? Is there a rule / convention that says which to use or is indifferent?
asked by 09.12.2014 / 12:09
2
answers

What's the difference between using (int) variable or Convert.ToInt32 (variable)?

What's the difference between them? When is it best to use one or the other? Examples: string palavra = "10"; var numero = Convert.ToInt32(palavra); // ou (int)palavra ? string palavra2 = "10.50"; var numero2 = (double)palavra2; // ou Conv...
asked by 06.10.2015 / 15:39
1
answer

How to remove the last number from an integer?

How can I remove the last number from an integer? Ex: int value = 123456789; int newValue = 12345678; Note that the new value does not have 9. I know it would be possible to change to a string and use the substring (), but I...
asked by 24.08.2017 / 14:54
2
answers

How does the function int deal with the character \ n?

I've created a list: usuarios = ['123\n','123\n4'] I tried to convert index 0 to integer using int() int(usuarios[0]) Result: 123 But when I tried to do the same with index 1: int(usuarios[1]) result:    ValueError:...
asked by 02.12.2018 / 20:43
2
answers

Algorithm in C to convert arabic number to roman number

How to do this conversion? It does not have to be the algorithm ready, I wanted a help at least in logic.     
asked by 26.05.2014 / 00:41
3
answers

Check if int is "null" in C #

In C # it is not possible to assign null to an integer value ( int , not int? ). However, how can I tell if an integer value ( int ) has not yet had an assigned value (being int )? int? valor; if (valor == nul...
asked by 15.08.2017 / 17:10
2
answers

How to convert text to number?

How do I convert a text that I know is an integer coming from externally? It would be something like ToInt() or something like that.     
asked by 20.02.2017 / 13:57