User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 456,234 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,817 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 318 | Replies: 1
Reply
Join Date: Oct 2007
Posts: 40
Reputation: dblbac is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
dblbac dblbac is offline Offline
Light Poster

Help error message on program

  #1  
Nov 12th, 2007
i received some help but when i implimented it into the program it came up with an error. if anyone could help me fix this problem i will greatly appreciate it. here is the program. it is a guessing game. the error message says:
error C2064: term does not evaluate to a function taking 1 arguments. it is talking about the following line: srand((unsigned)time(0))

  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. int main ()
  8. {
  9. int num;
  10. int guess;
  11. bool done;
  12. int noOfGuesses=0;
  13. int ncount;
  14. int sum=0;
  15. int noofgamesplayed;
  16. int avgNoOfGuesses;
  17. int time;
  18.  
  19.  
  20.  
  21. sum += noOfGuesses;
  22. avgNoOfGuesses=sum/noofgamesplayed;
  23. [color="Red"]srand((unsigned)time(0))[/color]
  24. ;num = (rand() % 1000);
  25. done = false;
  26. while ((noOfGuesses < 10) && (!done))
  27.  
  28. {
  29. cout << "Enter an integer greater"
  30. << " than or equal to 0 and "
  31. << "less than 1000: ";
  32. cin >> guess;
  33. cout << endl;
  34. noOfGuesses++;
  35. if (guess == num)
  36. {
  37. cout << "you guessed the correct "
  38. << "number." << endl;
  39. done = true;
  40. }
  41. else
  42. if (guess < num)
  43. cout << "Your guess is lower "
  44. << "than the number. \n"
  45. << "Guess again!" << endl;
  46. else
  47. cout << "Your guess is higher "
  48. << "than the number.\n"
  49. << "guess again!" << endl;
  50. cout <<"Total gueses equal " << noOfGuesses << endl;
  51.  
  52.  
  53.  
  54. }
  55. return 0;
  56. }
Last edited by Ancient Dragon : Nov 12th, 2007 at 9:16 pm. Reason: corrected code tags and add line numbers
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,539
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 40
Solved Threads: 972
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: error message on program

  #2  
Nov 12th, 2007
line 17 duplicates a function name. You need to rename that variable on line 17 to something else.
<<Freelance Programmer>> << Hobby Site>>
Signature links for sale. PM me for details
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 5:11 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC