| | |
What in the world does "type double unexpected" mean?
![]() |
•
•
Join Date: Nov 2009
Posts: 12
Reputation:
Solved Threads: 0
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
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
1
#2 21 Days Ago
This is line 111
should probably be:
C Syntax (Toggle Plain Text)
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:
C Syntax (Toggle Plain Text)
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.
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 To: Removing the type was already mentioned. I don't know how you found that correcting your code "only makes it a LOT worse".
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;
}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;
} "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
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.
![]() |
Similar Threads
- c2062 "Type 'double' unexpected" (C++)
- code works with type unsigned long but not with type double (C++)
- type 'double' unexpected (C)
- Evaluating sinx between 0 and 14 (C++)
- Trojan Horse - HELP PLEASE (Viruses, Spyware and other Nasties)
- invalid initialisation of reference of type 'double& ' (C++)
- '%' illegal, left operand, has type 'double' (C++)
Other Threads in the C Forum
- Previous Thread: urgent help needed in c
- Next Thread: errno - perror vs fprintf + strerror
| Thread Tools | Search this Thread |
#include adobe api array arrays asterisks binarysearch calculate char cm copyanyfile copyimagefile copypdffile cprogramme creafecopyofanytypeoffileinc createcopyoffile createprocess() csyntax database directory dynamic feet fflush fgets file fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o include incrementoperators input interest kernel kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix meter microsoft motherboard mqqueue mysql number odf open openwebfoundation owf pattern pdf performance pointer posix probleminc process program programming pyramidusingturboccodes radix read recursion recv repetition research scanf scheduling segmentationfault send sequential shape socket socketprograming stack standard string systemcall turboc unix user voidmain() wab win32api windows.h






