|
by: da Vinci |
last post by:
Hi Gents,
This is what I am trying to do.
Say you have a double or a float with the value 14.5624 for example.
How could I take that variable and get the 14 into an integer variable
and the .5624 into a double or float?
The reason is because of converting decimal locations into DMS. Math
is simple....
|
by: Darius Fatakia |
last post by:
hi,
i'm new to MS Visual Studio and C++ but not to C programming in general. i'm
trying to divide two integers and get their actual quotient (eg 5/3 =
1.666667 etc). i thought i had type cast correctly, but please let me know,
because it appears to be rounding off. my code follows. Thanks!
void DrawLine(GLint x1, GLint y1, GLint x2, GLint y2)
{
int i, pk, dy, dx, yc, xc, inc, temp;
|
by: Brent Lievers |
last post by:
Greetings,
I have a question about parsing a fixed-width integer from a string.
Lines of data are being read from a file having a very strict
column-delimited format. In my example below, columns 0-7 are an integer
and columns 8-23 are a float. In _most_ files, the first few columns of
the float are blank space to make it human readable. But not always.
So, once they have been read from the file, I try to parse out the
different...
|
by: J.Marsch |
last post by:
Suppose that I have an integer division problem, but I want the answer was a
float. What's the cleanest syntax for that?
Example:
In this code, the variable z ends up == 0. And that is correct, because
this is integer division and the values are trunc'd. No problem. But
what's the most elegant code given that x and y have to be ints, and I want
z to be a float or double?
Code:
|
by: Geky |
last post by:
Why when I multiply a float , for example X10, and than convert it as
an integer the new value is changed?
Example:
float fl = 1.8
int x;
x = int(fl * 10);
|
|
by: comp.lang.php |
last post by:
I'm involved in a rather nasty debate involving a strange issue
(whereby the exasperated tell me to RTFM even after my having done so),
where this is insanely possible:
print_r(is_int('1')); // PRINTS NOTHING
print_r(strlen((int)1)); // PRINTS '1'
Now I understand that in PHP, everything scalar is a string and can
|
by: gk245 |
last post by:
This is part of a bigger program, but i made it simple (basically the
OT_hours function is supposed to determine if the number entered is
over 40 hours or not and return the appropriate answer):
#include <stdio.h>
#include <stdlib.h>
struct person
{
float overtime;
|
by: iulian.ilea |
last post by:
I have this functions, c3 and c2 that computes and return a float
number. The problem is that wen I pass the result of c2 (float number)
to c3(), in function apears to be an integer. Ex.:
$calc2=c2(params); (float number)
$calc3=c3($calc2); ($calc2 - float number)
echo $calc3; (is not the number that supposed to be, because c4
computes $calc2 as if it were an integer: if $calc=39.96 it wil be
converted in 39).
What is the problem? I...
|
by: arindam.mukerjee |
last post by:
I was running code like:
#include <stdio.h>
int main()
{
printf("%f\n", 9/5);
return 0;
}
|
by: shellon |
last post by:
Hi all:
I want to convert the float number to sortable integer, like the
function float2rawInt() in java, but I don't know the internal
expression of float, appreciate your help!
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
|