int Questions

5

Solved

This string returns the value: Pressure 770.3157279 mm <div class="info">Pressure {{info.main.pressure * 0.750064}} mm </div> How do I make the number become an integer and get: Pres...
Laurence asked 14/1, 2020 at 13:52

12

Solved

What is the shortest way, preferably inline-able, to convert an int to a string? Answers using stl and boost will be welcomed.
Trivalent asked 12/1, 2011 at 12:26

5

Solved

I am running the exact same code on both windows and mac, with python 3.5 64 bit. On windows, it looks like this: >>> import numpy as np >>> preds = np.zeros((1, 3), dtype=int)...
Aland asked 11/7, 2016 at 18:51

15

I have a char[] that contains a value such as "0x1800785" but the function I want to give the value to requires an int, how can I convert this to an int? I have searched around but cannot find an a...
Remodel asked 14/4, 2012 at 18:58

7

I have this question that has completely stumped me. I have to create a variable that equals Integer.MAX_VALUE... (in Java) // The answer must contain balanced parentesis public class Exercise{ ...
Cobnut asked 6/4, 2014 at 1:31

31

Solved

PHP has an intval() function that will convert a string to an integer. However I want to check that the string is an integer beforehand, so that I can give a helpful error message to the user if it...
Trimerous asked 6/1, 2010 at 10:21

19

Below is a code snippet, int a = 1; char b = (char) a; System.out.println(b); But what I get is empty output. int a = '1'; char b = (char) a; System.out.println(b); I will get 1 as my output....
Matherly asked 1/8, 2013 at 3:51

8

Solved

I'm currently working on an encryption/decryption program and I need to be able to convert bytes to an integer. I know that: bytes([3]) = b'\x03' Yet I cannot find out how to do the inverse. Wha...
Beutler asked 30/11, 2015 at 23:4

4

Solved

I would like to know how can I sort a string by the number inside. As example I have: hello = " hola %d" % (number_from_database) bye = "adios %d" % (number_from_database_again) I want to sort ...
Hypothec asked 5/6, 2013 at 17:40

28

Solved

How do I convert an integer to a hex string in C++? I can find some ways to do it, but they mostly seem targeted towards C. It doesn't seem there's a native way to do it in C++. It is a pretty sim...
Wiatt asked 24/2, 2011 at 5:26

7

Solved

int i; int data[5] = {0}; data[0] = i; What's the value in data[0]? Also, what's the meaning of this line? if (!data[0]) { ... }
Systematism asked 26/12, 2010 at 5:28

8

Solved

I want to take the nth digit from an N digit number in python. For example: number = 9876543210 i = 4 number[i] # should return 6 How can I do something like that in python? Should I change it t...
Schweiker asked 22/9, 2016 at 16:46

8

Solved

What is the best way to return the whole number part of a decimal (in c#)? (This has to work for very large numbers that may not fit into an int). GetIntPart(343564564.4342) >> 343564564 Ge...
Esma asked 26/1, 2009 at 12:59

11

Solved

I am trying to solve: int total=0, number=0; float percentage=0.0; percentage=(number/total)*100; printf("%.2f", percentage); If the value of the number is 50 and the total is 100, I should get...
Ken asked 23/11, 2012 at 13:34

9

Solved

How do I divide two integers to get a double?
Ify asked 19/3, 2009 at 4:9

5

I have a class whose constructor takes 2 int parameters (null values are allowed). Following is the compilation error. None of the following functions can be called with the arguments supplied: ...
Interstadial asked 30/5, 2017 at 7:2

3

Solved

I have two integers, x and y. What I am trying to do, is combine the numbers in both, not add them together. I have tried to do this: int x = 5; int y = 10; sum = x + y; But that makes the outpu...
Perturb asked 25/1, 2014 at 22:26

8

Solved

I'm fairly new to Java and I'm using BlueJ. I keep getting this "Int cannot be dereferenced" error when trying to compile and I'm not sure what the problem is. The error is specifically happening i...
Exterior asked 1/10, 2013 at 6:8

4

Solved

Below is a section of code which is part of a functional decryption and encryption program. while checkvar < maxvar: # is set to < as maxvar is 1 to high for the index of var #output.append(...
Frisian asked 21/11, 2012 at 17:44

5

Solved

I always assumed that booleans were more efficient than ints at storing an on/off value - considering that's their reason for existence. I recently decided to check if this is true with the help of...
Microsporangium asked 28/8, 2011 at 15:48

20

Solved

I have a char in c#: char foo = '2'; Now I want to get the 2 into an int. I find that Convert.ToInt32 returns the actual decimal value of the char and not the number 2. The following will work: ...
Gennie asked 27/10, 2008 at 4:49

11

Solved

I tried int.parse, and convert class to convert a string to int. While I'm converting. I'm losing the 0 in the beginning which i don't want. Ex : 09999 becomes 9999 - I don't want this. I want t...
Candent asked 7/7, 2011 at 18:37

5

Solved

I want to store Zip Code (within United States) in MySQL database. Saving space is a priority. which is better option using VARCHAR - limited to maximum length of 6 digit or using INT or using MEDI...
Crafton asked 5/4, 2013 at 21:14

10

Solved

How do I increment a Integer's value in Java? I know I can get the value with intValue, and I can set it with new Integer(int i). playerID.intValue()++; does not seem to work. Note: PlayerID is...
Parr asked 28/9, 2010 at 16:57

8

In my program I'm looking at a string and I want to know if it represents a 32-bit integer. Currently I first check if it is a digit at all using isdigit(), then I check if it exceeds the value of...
Inspiratory asked 13/8, 2012 at 5:37

© 2022 - 2024 — McMap. All rights reserved.