This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
If I have a double: 732734
How can I return 73273 <---- notice the loss of the '4'
Divide by 10 and then floor it to remove the decimals:
number = floor(number / 10.0)
I found this somewhere. It removes the last digits after decimal. Not the actual solution but this might give you some hint:
int main(){
for (int a=0;a<80;a++)
printf(".");
printf("%2.0f\n",1024.48);
printf("%2.0f\n",4.48);
for (int a=0;a<80;a++)
printf(".");
return 0;
}
Output:
................................................................................
1024
4
................................................................................
Related
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
So i got simple code to change all _ to space but...it doesnt work! Any1 knows why? I have no idea
while (fout >> array[x][y]){
if (array[x][y]=='_') array[x][y]==' ';
y++;
if (y==8) {
y=0;
x+=1;
}
}
Take a look at this line:
if (array[x][y]=='_') array[x][y]==' ';
^
You have two equal signs when you are attempting to set the new value.
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
How can i write this line of code in Coffeescript? Thank's
window.scrollY >= origOffsetY ? navbar.classList.add('navbar-fixed-top') :
navbar.classList.remove('navbar-fixed-top');
I try this, but doesn't work.
if window.scrollY >= origOffsetY then navbar.classList.add('navbar-fixed-top') else navbar.classList.remove('navbar-fixed-top')
Your coffeescript compiles to :
if (window.scrollY >= origOffsetY) {
navbar.classList.add('navbar-fixed-top');
} else {
navbar.classList.remove('navbar-fixed-top');
}
This seems pretty OK for me.
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
Can someone help me out here? I need a regex that will match the following pattern:
10-(any 5 digits except 73480)-(any 4 digits)
Examples
valid: 10-12345-1234
invalid: 10-73480-1234
Thanks
You should use negative lookahead to check for any occurance of 10-73480 before matching..
^(?!10-73480)10-\d{5}-\d{4}$
Try it here
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
Can anyone tell me meaning or possible values of below regular expression?
/(\+\d{2})/
Plus followed by a number on 2 digits.
This matches for instance: +23
A + followed by 2 digits: +23 +01 etc.
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I've seen a pretty strange (for me) usage of this method:
strncpy(somePointer,"%d",someInt);
What does this actually do? The integer specifier "%d" as the source is troublesome for me to understand.
It does what it says on the tin: It copies the literal string "%d" into a char buffer pointed to by somePointer, or at least the first someInt bytes of it (up to three).
Don't be upset by a percentage sign, it's just another character...