int Questions

11

Solved

This is a rather silly question but why is int commonly used instead of unsigned int when defining a for loop for an array in C or C++? for(int i;i<arraySize;i++){} for(unsigned int i;i<arra...
Kidder asked 20/9, 2011 at 16:57

5

Solved

[Xcode 7.1, iOS 9.1] I have an array: var array: [String] = ["11", "43", "26", "11", "45", "40"] I want to convert that (each index) into an Int so I can use it to countdown from a timer, respec...
Aplite asked 26/10, 2015 at 14:19

14

Solved

I recently read a sample job interview question: Write a function to convert an integer to a string. Assume you do not have access to library functions i.e., itoa(), etc... How would you g...
Dialogize asked 20/10, 2010 at 21:8

4

Solved

I have seen countless examples and tutorials that show how to create a file and all of them "cheat" by just setting the permission bits of the file. I would like to know / find out how to properly ...
Voyles asked 10/3, 2015 at 16:47

3

Solved

Given a variable in python of type int, e.g. z = 50 type(z) ## outputs <class 'int'> is there a straightforward way to convert this variable into numpy.int64? It appears one would have...
Regimen asked 11/10, 2017 at 23:55

10

I'm new on this site and, if I'm here it's because I haven't found the answer anywhere on the web and believe me: I've been googling for quite a time but all I could find was how to convert a numbe...
Gouda asked 28/1, 2014 at 20:37

12

Solved

So I have an IEnumerable<string> which can contain values that can be parsed as int, as well as values that cannot be. As you know, Int32.Parse throws an exception if a string cannot be chan...
Bedplate asked 10/2, 2011 at 19:28

3

Solved

I have been assigned a homework assignment to prompt the user for 3 positive integers then compare and print them in order of largest, median and smallest. Prompting and writing a while loop to c...
Elba asked 11/7, 2013 at 22:55

4

Solved

When opening a CSV file, the column of integers is being converted to a string value ('1', '23', etc.). What's the best way to loop through to convert these back to integers? import csv with open...
Ponceau asked 5/11, 2015 at 14:55

9

Solved

I've struggled and failed for over ten minutes here and I give in. I need to convert an Int to a Character in Swift and cannot solve it. Question How do you convert (cast) an Int (integer) to a ...
Wrongly asked 14/12, 2015 at 3:42

12

Solved

How can I convert an int datatype into a string datatype in C#?
Abscissa asked 21/6, 2010 at 3:14

3

I'm trying to generate a number based on a seed in C#. The only problem is that the seed is too big to be an int32. Is there a way I can use a long as the seed? And yes, the seed MUST be a long.
Outflank asked 17/3, 2013 at 16:14

4

Solved

I want to do some basic validation on a user input in PowerShell to ensure a user can only enter a whole integer and does not enter -7 for example. I am not sure how this is done and would apprecia...
Dalessandro asked 12/5, 2016 at 13:51

4

Solved

I am making a math solving program, it keeps printing the whole numbers as decimals. Like 1 is 1.0, 5 is 5.0, and my code is: print("Type in the cooridinates of the two points.") print("") print...
Fourchette asked 27/10, 2012 at 3:55

9

Solved

There are two unsigned ints (x and y) that need to be subtracted. x is always larger than y. However, both x and y can wrap around; for example, if they were both bytes, after 0xff comes 0x00. The ...
Gramme asked 13/1, 2010 at 23:56

9

Solved

I'm learning Java, coming from C and I found an interesting difference between languages with the boolean type. In C there is no bool/ean so we need to use numeric types to represent boolean logic ...
Cubit asked 10/12, 2012 at 17:29

6

Basically, I'm converting a float to an int, but I don't always have the expected value. Here's the code I'm executing: x = 2.51 print("--------- 251.0") y = 251.0 print(y) print(int(y)) ...
Rolandrolanda asked 4/7, 2011 at 9:25

10

Solved

Is there a preferred way to keep the data type of a numpy array fixed as int (or int64 or whatever), while still having an element inside listed as numpy.NaN? In particular, I am converting an in-...
Anastasiaanastasie asked 18/7, 2012 at 18:30

4

Solved

I am using the following line within a Select which returns a number with decimals, e.g. 33.33333. How can I round this within the Select and convert to integers so that I don't have decimals, e....
Accidence asked 18/4, 2014 at 12:48

7

Solved

I've noticed I've always used int and doubles no matter how small or big the number needs to be. So in java, is it more efficient to use byte or short instead of int and float instead of double? S...
Hibernicism asked 25/1, 2013 at 20:22

12

Solved

I'd like to convert an Int in Swift to a String with leading zeros. For example consider this code: for myInt in 1 ... 3 { print("\(myInt)") } Currently the result of it is: 1 2 3 But I want...
Fidellia asked 29/8, 2014 at 10:36

4

Solved

I'm reading in an id3 tag where the size of each frame is specified in 3 bytes. How would I be able to utilize this value as an int?
British asked 27/3, 2012 at 19:45

6

Solved

I read this from msdn about Int32.TryParse() When this method returns, contains the 32-bit signed integer value equivalent to the number contained in s, if the conversion succeeded, or zero i...
Chretien asked 29/12, 2010 at 8:53

11

As mentioned in the title, I'm looking for something that can give me more performance than atoi. Presently, the fastest way I know is atoi(mystring.c_str()) Finally, I would prefer a solution ...
Uchish asked 30/5, 2013 at 1:15

16

Solved

How can I check if a given number is within a range of numbers?
Pouf asked 13/1, 2011 at 18:55

© 2022 - 2024 — McMap. All rights reserved.