Understanding Syntax errors for C++

Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2005
Posts: 1
Reputation: Sef is an unknown quantity at this point 
Solved Threads: 0
Sef Sef is offline Offline
Newbie Poster

Understanding Syntax errors for C++

 
0
  #1
Aug 7th, 2005
I'm using a program called Dev C++. Sometimes I am able to solve the syntax erros and sometimes I am not able to do so cause I do not understand it although it's logical.
There is an error message which displays "warning: assignment to 'int' from 'double'".
I had to write a program using 4 arrays that are passed into multiple functions. In my program I had to calculate Kilometers per liter and to calculate it I had to first convert miles to Kilometers and convert gallons to liter than dividing the two to obtain the km per liter. Miles and gallons are declared as int arrays and the constant km and liter are declared automatically as double using '#define' so any suggestions!!!!!!
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,868
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 755
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Senior Bitch

Re: Understanding Syntax errors for C++

 
0
  #2
Aug 7th, 2005
>There is an error message which displays "warning: assignment to 'int' from 'double'".
That's not an error, it's a warning. It's telling you that the fractional part of a floating-point value will be truncated when you assign it to an integer variable. You fix it by using doubles instead of ints.
New members chased away this month: 5
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1666 | Replies: 1
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC