My program basically takes an int studentID from a file and outputs it to a new file, but the problem is when the ID is entered as &quot;00000&quot; it is stored and prints as &quot;0&quot;.  Is there an easy way to keep the leading zeros when printing it?
26743
How can I format my output in C++? In other words, what is the C++ equivalent to the use of printf like this:  printf("%05d", zipCode);   I know I could just use printf in C++, but I would prefer the output operator &lt;&lt;.  Would you just use the following?  std::cout &lt;&lt; "ZIP code: " &lt;&lt; sprintf("%05d", zipCode) &lt;&lt; std::endl;
33452
In a shell script, I'm processing, some addition process will print an output. If it is a single-digit one, then it has to add zero as a prefix. Here is my current script: c_year=2020 for i in {01..11}         do               n_year=2020             echo 'Next Year:'$n_year             if [[ $i == 11 ]]             then n_month=12             echo 'Next Month:'$n_month             else              n_month=$(($i + 1))             echo 'Next Month:'$n_month             fi             echo $date&quot; : Processing data '$c_year-$i-01 00:00:00' and '$n_year-$n_month-01 00:00:00'&quot;         done  The i value is in doule digit, but the n_month is still printing single digit. How do I set default shell output should return as double digit? Or any alternate way to solve this?
61612
I'm looking for a  way to convert numbers to string format, dropping any redundant '.0'   The input data is a mix of floats and strings. Desired output:  0   --> '0'  0.0 --> '0'  0.1 --> '0.1'  1.0 --> '1'  I've come up with the following generator expression, but I wonder if there's a faster way:  (str(i).rstrip('.0') if i else '0' for i in lst)   The truth check is there to prevent 0 from becoming an empty string.  EDIT: The more or less acceptable solution I have for now is this:  ('%d'%i if i == int(i) else '%s'%i for i in lst)   It just seems strange that there is no elegant way to handle this (fairly straightforward) case in python.
107627
Is it the same convention as those used in known programming languages such as Java and C? I'm trying to create a lot of variables and I want it to start with a number, but I'm not sure if it's okay.
82601
I'm trying to convert an incoming sting of 1s and 0s from stdin into their respective binary values (where a string such as "11110111" would be converted to 0xF7). This seems pretty trivial but I don't want to reinvent the wheel so I'm wondering if there's anything in the C/C++ standard libs that can already perform such an operation?
77376
var i : integer;  i := 1234567;   Given the above, I want the string "1,234,567" as output (assuming UK locale). IntToStr just gives me "1234567". I'm sure there's a one-liner for this, but I can't find it...
82090
int i = 4; string text = "Player "; cout &lt;&lt; (text + i);   I'd like it to print Player 4.  The above is obviously wrong but it shows what I'm trying to do here. Is there an easy way to do this or do I have to start adding new includes?
40121
I have a string "1112224444' it is a telephone number. I want to format as 111-222-4444 before I store it in a file. It is on a datarecord and I would prefer to be able to do this without assigning a new variable.  I was thinking:  String.Format("{0:###-###-####}", i["MyPhone"].ToString() );   but that does not seem to do the trick.  ** UPDATE **  Ok. I went with this solution  Convert.ToInt64(i["Customer Phone"]).ToString("###-###-#### ####")   Now its gets messed up when the extension is less than 4 digits. It will fill in the numbers from the right. so  1112224444 333  becomes  11-221-244 3334   Any ideas?
43017
when I try to write 90% I do 90 $%$ , but none works and anything after the % doesn't print in the output, any solution ?
119912
An integer's max value in Java is 2147483647, since Java integers are signed, right?  0xff000000 has a numeric value of 4278190080.  Yet I see Java code like this:  int ALPHA_MASK = 0xff000000;   Can anyone enlighten me please?
41750
If I type in a 16 digit number (format: number, no decimals) it changes the number on me. Example: 1234567812345678 changes the view to 1234567812345670.    If I type it in as a general format it changes the numbers above so it displays 1.23457E+15 but if you click on the cell, the display shows the last digit as a 0 instead of an 8 once again.   I opened the file on a different computer and same issue now with it.  I have changed the auto correction and auto formatting all to no avail.  Help!
111324
I declare a variable for a 64 bit counter as :  long long call_count;   What is the format specifier that I should use in print statements?  I tried, %l, %ld, %ll. None seems to be correct.  I use Diab C compiler for compiling my application code to run on pSOS operating system.
90792
I have a couple tables in which I created an object ID as either an Int or Bigint, and in both cases, they seem to autoincrement by 10 (ie, the first insert is object ID 1, the second is object ID 11, the third is object ID 21, etc).  Two questions:   Why does it do that? Is that a problem?
104482
What is the best way to convert an Int value to the corresponding Char in Utf16, given that the Int is in the range of valid values?
59699
Here is the code.  \documentclass{article} \begin{document} \directlua{tex.sprint(tostring(math.sin(math.pi)))} \\ \directlua{tex.sprint(tostring(math.tan(math.pi/2)))} \end{document}   I am expecting the answers as 0 and error . The code above gives some very small and big number. Can I get the expected answers by some modifications in code?
76762
I have written a Python 3 code, which is:  i = int(input("enter number: ")) print("enter",i)   I'm expecting an output as:  enter number: 5 enter 5   However, I'm getting this:  enter number: 5 ('enter', 5)   What could be the issue? How can I rectify this?
107670
Why is it bad to name a variable id in Python?