473,325 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

getting rid of warning: C4244

Hello, this part of my program:

int shotDistance(int a)
{
int min = a * .8, max = a * 1.2; //Defines the minimum and maximum range of the club.
srand ((unsigned int) time(NULL));
a = min + (rand() % (max - min)) ; //calculates the random shot distance.

return a; //returns the distance to main().

}

gives warning:C4244 'initializing' : conversion from 'double' to 'int', possible loss of data

I really dont know what to do to get rid of this warning, please help!
Apr 27 '08 #1
1 4310
Savage
1,764 Expert 1GB
Is this yours?



Savage
Apr 27 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Chefry | last post by:
I'm trying to set up an off the shelf script and keep getting an error. My host set up the mysql on my site and I changed the variables I had to in the settings.php file but I keep getting the...
1
by: Josué Andrade Gomes | last post by:
Take this code: 1: int main() 2: { 3: unsigned short x = { 1, 2, 3, 4, 5 }; 4: unsigned short sum = 0; 5: 6: for (int i = 0; i < 5; ++i) { 7: sum += x; 8: } 9: }
11
by: Henryk | last post by:
I have some very simple code fragment: short int n1, n2; .... n1 += n2; I get an warning from VS2003 - VS2005: warning C4244: '+=' : conversion from 'int' to 'short', possible loss of data ...
0
by: malini | last post by:
Hi I am new to vc++. currently using VC 2005 version 8 Someone help me solve this. lpppublishdimincent.cpp(294) : warning C4244: 'argument' : conversion from 'const lpmINT64' to 'char', possible...
1
by: desivirus | last post by:
hi admin.. i followed your tip in "HOW TO LIST PROCESS ID IN WINDOWS" thread..and iam trying to compile this code in cygwin , $gcc -mno-cygwin process.c -o -L"psapi.lib" process.exe psapi.h...
21
by: Roman Mashak | last post by:
Hello, given a simple code: #include <math.h> long hyp(long height, long base) { return sqrt(height * height + base * base); }
2
by: david | last post by:
I've noticed that the following compiles (as C) under both VS8 and gcc with no warnings, even though there's a possibility of data truncation from enum to unsigned char. It does generate a warning...
4
by: imaloner | last post by:
I am posting two threads because I have two different problems, but both have the same background information. Common Background Information: I am trying to rebuild code for a working,...
5
by: qwert7465 | last post by:
any help would be appreciated. here is my code: // Final Project #include <iostream.h> #include <iomanip.h> void checkout();
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.