What in the world does "type double unexpected" mean?

Reply

Join Date: Nov 2009
Posts: 12
Reputation: A Tripolation is an unknown quantity at this point 
Solved Threads: 0
A Tripolation A Tripolation is offline Offline
Newbie Poster

What in the world does "type double unexpected" mean?

 
0
  #1
21 Days Ago
So I finally get to the end of this evil program, and then it won't compile because it says "type double not expected".

Here is my error message in its entirety:
program 3 item.cpp(111) : error C2062: type 'double' unexpected
program 3 item.cpp(121) : error C2062: type 'double' unexpected
program 3 item.cpp(131) : error C2062: type 'double' unexpected

And here is a link to my codes (with the line numbers, so hopefully it won't be that hard to see what I'm doing wrong)
http://pastebin.com/mff1e676

Thanks for the help
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 346
Reputation: gerard4143 is on a distinguished road 
Solved Threads: 44
gerard4143's Avatar
gerard4143 gerard4143 is offline Offline
Posting Whiz
 
1
  #2
21 Days Ago
This is line 111

  1. height_earth = double distance_earth(float speed, double radians)* (tan(radians)) - (G_earth * (pow(double distance_earth(float speed, double radians), 2))) / ((2(pow((speed)(cos(radians), 2)))));

should probably be:

  1. height_earth = distance_earth(speed, radians)* (tan(radians)) - (G_earth * (pow(distance_earth(speed, radians), 2))) / ((2(pow((speed)(cos(radians), 2)))));
Last edited by gerard4143; 21 Days Ago at 12:12 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 12
Reputation: A Tripolation is an unknown quantity at this point 
Solved Threads: 0
A Tripolation A Tripolation is offline Offline
Newbie Poster
 
0
  #3
21 Days Ago
Hmm...no man, that only makes it a LOT worse, but thanks for trying. I appreciate it. Here's some rep
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 346
Reputation: gerard4143 is on a distinguished road 
Solved Threads: 44
gerard4143's Avatar
gerard4143 gerard4143 is offline Offline
Posting Whiz
 
0
  #4
21 Days Ago
Originally Posted by A Tripolation View Post
Hmm...no man, that only makes it a LOT worse, but thanks for trying. I appreciate it. Here's some rep
I said it should probably be - you have some very serious errors in your code. The foremost is you don't know how to call a function..
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 201
Reputation: yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold 
Solved Threads: 35
yellowSnow's Avatar
yellowSnow yellowSnow is offline Offline
Posting Whiz in Training
 
0
  #5
21 Days Ago
Originally Posted by A Tripolation View Post
Hmm...no man, that only makes it a LOT worse, but thanks for trying. I appreciate it. Here's some rep
At any rate, if you haven't noticed, this is a forum on C not C++. You should post your questions in the correct forum.
Manic twiddler of bits
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,335
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 236
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c
 
0
  #6
21 Days Ago
You'll need to make a lot of changes to your functions given this sort of pattern...

From (extraneous type needs to be removed, multiplication is done using * , feed the pow function the correct number of parameters):
double height_moon (float speed, double radians, double distance_moon(float speed, double radians))
{
	double height_moon, G_moon;
	G_moon = 1.62;

	height_moon = double distance_moon(float speed, double radians) * (tan(radians)) - (G_moon * (pow(double distance_moon(float speed, double radians), 2))) / ((2(pow((speed)(cos(radians), 2)))));
	return height_moon;
}
To:
double height_moon (float speed, double radians, double distance_moon(float speed, double radians))
{
   double height_moon, G_moon;
   G_moon = 1.62;

   height_moon = distance_moon(speed, radians) * (tan(radians)) - (G_moon * (pow(distance_moon(speed, radians), 2))) / ((2 * (pow(speed, (cos(radians), 2)))));
   return height_moon;
}
Removing the type was already mentioned. I don't know how you found that correcting your code "only makes it a LOT worse".
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 21
Reputation: banders7 is an unknown quantity at this point 
Solved Threads: 0
banders7's Avatar
banders7 banders7 is offline Offline
Newbie Poster
 
0
  #7
13 Days Ago
If you're attempting to cast the variables to a different type, the type needs to be enclosed in parentheses. e.g., (double) distance_moon((float) speed, (double) radians). If the variables are defined as the proper type to begin with, there is no need to cast them. Specifying types is appropriate in the function prototype or header, but not in the call to the procedure.
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC