| | |
Parsing error
Thread Solved
![]() |
•
•
Join Date: Oct 2007
Posts: 30
Reputation:
Solved Threads: 0
Hi all,
I used a function called GetRandomVariable to return a double data type and here's its code:
but unfortunately i got the following error:
Error 1 error C2296: '%' : illegal, left operand has type 'double'
I used a function called GetRandomVariable to return a double data type and here's its code:
C++ Syntax (Toggle Plain Text)
double GetRandomNumber(void) { // Zi = (AZi-1 + C)(mod m) // Zi = (5Zi-1 + 3)(mod 16) RandomVariableGenerator::Znode = (double)((5.0*RandomVariableGenerator::Znode + 3) % 16); return RandomVariableGenerator::Znode/16; } static double Znode = 7.0;
Error 1 error C2296: '%' : illegal, left operand has type 'double'
There is hope!
Use fmod to resolve the modulus between two doubles
Use fmod to resolve the modulus between two doubles
c++ Syntax (Toggle Plain Text)
#include <iostream> using std::cin; using std::cout; using std::endl; int main(){ double x = fmod(4.5, 3.22); cout << x << endl; // 1 R 1.28, so 1.28 should print out cin.get(); return 0; }
![]() |
Similar Threads
- XML Parsing Error: junk after document element (XML, XSLT and XPATH)
- Wordpress Blog Help. Getting Error. Need Help Please. (PHP)
- PHP parsing error, unexpected '<' (PHP)
- SMF parsing error (PHP)
- parsing error (XML file-java-schema) (Java)
Other Threads in the C++ Forum
- Previous Thread: converting bool[8] to char
- Next Thread: automating login to a server using c++
| Thread Tools | Search this Thread |
api array based binary bitmap c++ c/c++ char class classes code coding compile console conversion count delete deploy desktop developer devlopment directshow dll download drawing duplication dynamic dynamiccharacterarray email encryption error file format forms fstream function functions game givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project python random read recursion reference retarded-mentally rpg segmentationfault selectionsort staticmembers string strings temperature template test text text-file tree update url variable vector video win32 windows winsock word wordfrequency wxwidgets






