943,013 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 73
  • C++ RSS
Sep 2nd, 2010
-1

final project, last error

Expand Post »
The only error stated is at "N_showdata.N_enterData();" which says "error C2660: 'NomineeData::N_enterData' : function does not take 0 arguments"
C++ Syntax (Toggle Plain Text)
  1. #include<iostream>
  2. #include<conio.h>
  3. #include<string>
  4. using namespace std;
  5.  
  6. class MemberData
  7. {
  8. private:
  9. int ID ;
  10. char Name[60];
  11. char Add[60];
  12. char Tel[15];
  13. public:
  14. void enterData();
  15. void showData(void);
  16. };
  17. void MemberData::enterData()
  18. {
  19. cout << "Please enter your Membership number: " << endl;
  20. cin >>ID;
  21. cout << "Please enter your Name: "<< endl;
  22. cin >>Name;
  23. cout << "Please enter your Address: " << endl;
  24. cin >>Add;
  25. cout << "Please enter your Handphone number: " << endl;
  26. cin >>Tel;
  27. }
  28. void MemberData::showData(void)
  29. {
  30. cout << "Member ID is: "<< ID << endl;
  31. cout << "Member Name is: "<< Name << endl;
  32. cout << "Member's Add is: "<< Add << endl;
  33. cout << "Member's Tel is: "<< Tel << endl;
  34. }
  35. class NomineeData : public MemberData //Derived from class MemberData allow the user enter
  36. //the nominees' particular
  37. {
  38. private:
  39. char N_ID[20];
  40. char N_Name[20];
  41. public:
  42. void N_enterData(char N_ID, char N_Name);
  43. void N_showData(void);
  44. };
  45. void NomineeData::N_enterData(char N_ID, char N_Name)
  46. {
  47. cout << "Please enter Nominee's ID: " << endl;
  48. cin >> N_ID;
  49. cout << "Please enter Nominee's Name: " << endl;
  50. cin >> N_Name;
  51. }
  52. void NomineeData::N_showData(void)
  53. {
  54. cout << "Nominee's ID is: "<< N_ID << endl;
  55. cout << "Nominee's Name is: "<< N_Name << endl;
  56. }
  57. class ShowNname : public NomineeData //Derived from class MemberData
  58. {
  59. private:
  60. string JamesTan, BennyKoh, StevenLim, DavidTay, MaryTan;
  61. public:
  62. void Showname();
  63. };
  64. void ShowNname::Showname(void)
  65. {
  66. cout << "Nominee No.1 "<<" JamesTan"<<endl;
  67. cout << "Nominee No.2 "<<" BennyKoh"<<endl;
  68. cout << "Nominee No.3 "<<" StevenLim"<<endl;
  69. cout << "Nominee No.4 "<<" DavidTay"<<endl;
  70. cout << "Nominee No.5 "<<" MaryTan"<<endl;
  71. }
  72. int main()
  73. {
  74. MemberData show_data;
  75. NomineeData N_showdata;
  76. ShowNname show_name;
  77.  
  78. show_data.enterData();
  79. show_data.showData();
  80. N_showdata.N_enterData();
  81. N_showdata.N_showData();
  82. show_name.Showname();
  83.  
  84.  
  85. int Vote_Amount[6]={0};//set amunt of votes
  86. int key=0;
  87. cout << "Please vote nominee by enter the noimee number" << endl;
  88.  
  89. while((key=getch())!=0x27)
  90. {
  91. switch(key)
  92. {
  93. case '1':Vote_Amount[1]++;break;
  94. case '2':Vote_Amount[2]++;break;
  95. case '3':Vote_Amount[3]++;break;
  96. case '4':Vote_Amount[4]++;break;
  97. case '5':Vote_Amount[5]++;break;
  98. }
  99.  
  100. for(int i=1;i<6;i++)
  101. cout<< "Nominee No."<< i <<" won "<<Vote_Amount[i]<< " vote(s)"<<endl;
  102. }
  103. return 0;
  104. }
Last edited by cnmsg007; Sep 2nd, 2010 at 11:01 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cnmsg007 is offline Offline
8 posts
since Aug 2010
Sep 2nd, 2010
0
Re: final project, last error
Quote ...
C++ Syntax (Toggle Plain Text)
  1. N_showdata.N_enterData()
Does this line look right to you (appx Line 6 of main()) when compared to this?
Quote ...
C++ Syntax (Toggle Plain Text)
  1. void N_enterData(char N_ID, char N_Name);
Oh, and where are your [CODE]...code tags...[/CODE]?
Last edited by Fbody; Sep 2nd, 2010 at 11:03 am.
Featured Poster
Reputation Points: 833
Solved Threads: 392
Posting Maven
Fbody is offline Offline
2,846 posts
since Oct 2009
Sep 2nd, 2010
0
Re: final project, last error
>>"N_showdata.N_enterData();" which says "error C2660: 'NomineeData::N_enterData' : function does not take 0 arguments"

It means exactly what it says.
Reputation Points: 817
Solved Threads: 32
Nearly a Posting Virtuoso
Duki is offline Offline
1,474 posts
since Jun 2006
Sep 2nd, 2010
0
Re: final project, last error
okay, now after I ran this programme, it did not run as what I expected.
The outputs of Nominee No and Nominee name parts displayed a lot of strange chinese characters, and the loop is an infinite loop but what I want is to automatically stop after 3 votes.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cnmsg007 is offline Offline
8 posts
since Aug 2010
Sep 4th, 2010
0
Re: final project, last error
Looking at your code, I have find the possible error.
problem is in line no 80 of your code.
you cannot declare a method in C++ as temp( char *, char * ) and call it later as temp (void ) in main.

Just upon reexamining your code, your program have more problems than that. Simply you cannot thing that C++ will automatically convert char to char *
-Manoj
Last edited by manojwali; Sep 4th, 2010 at 1:50 am.
Reputation Points: 6
Solved Threads: 8
Light Poster
manojwali is offline Offline
40 posts
since Sep 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: c++ and libcurl: fopen as a function cause an error
Next Thread in C++ Forum Timeline: IOCP thread pooling question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC