C++ error C2660

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raveneros
    New Member
    • Mar 2007
    • 2

    C++ error C2660

    error C2660: 'checkF' : function does not take 1 parameters
    this is the error.

    Code:
        void checkF(char s[],char dStr[]) 
    	{
          for (int i=0; i<count; ++i)
    		  if (strcmp(s, list[i].getId())==0) 
    		  {
    	 		   if (strcmp(dStr, list[i].getExpiryDate())==0)
     				{
     					cout<<endl;
     		   			cout<<" "<<list[i].getName();
     					cout<<" membership has expired! Please pay renewal fee of $120. Thank you"<<endl;
     				}
    	
    		  } 
    	}
    any help i will be very grateful
  • svlsr2000
    Recognized Expert New Member
    • Feb 2007
    • 181

    #2
    Originally posted by raveneros
    error C2660: 'checkF' : function does not take 1 parameters
    this is the error.

    Code:
        void checkF(char s[],char dStr[]) 
    	{
          for (int i=0; i<count; ++i)
    		  if (strcmp(s, list[i].getId())==0) 
    		  {
    	 		   if (strcmp(dStr, list[i].getExpiryDate())==0)
     				{
     					cout<<endl;
     		   			cout<<" "<<list[i].getName();
     					cout<<" membership has expired! Please pay renewal fee of $120. Thank you"<<endl;
     				}
    	
    		  } 
    	}
    any help i will be very grateful
    Can you post the calling of this function. This error usually occurs when function is called with an incorrect number of parameters.

    Comment

    • raveneros
      New Member
      • Mar 2007
      • 2

      #3
      Code:
       
      class SnowCoMember {
       public:
      
          void checkF(char s[],char dStr[]) 
      	{
            for (int i=0; i<count; ++i)
      		  if (strcmp(s, list[i].getId())==0) 
      		  {
      	 		   if (strcmp(dStr, list[i].getExpiryDate())==0)
       				{
       					cout<<endl;
       		   			cout<<" "<<list[i].getName();
       					cout<<" membership has expired! Please pay renewal fee of $120. Thank you"<<endl;
       				}
      	
      		  } 
      	}
      
       private:
         CoMember list[100];
         int count;
      };
      
      void main() {
        SnowCoMember CoMem;
        char dateStr [9];
        char currentStr [9];
        int year;
        char choice;
      	_strdate(currentStr);
      	_strdate(dateStr);
      
      do{
      	  system("cls");
      	  menu();
      	  cin>>choice;
                    switch (choice)  {
      		case '1':
      			char s[30];
      		            cout<<endl<<"Enter member id: "<<endl;
      		            gets(s);
      			CoMem.checkF(s);
      			cout<<endl<<"Press enter to continue...."<<endl;
      			getch();
      		break;
      	}while (choice!='2');
      }
      this is not the complete code.

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        case '1':
        char s[30];
        cout<<endl<<"En ter member id: "<<endl;
        gets(s);
        //
        //Where's the second argument?
        // VVVVVVVVVVVVVVV VVVVVV
        CoMem.checkF(s) ;
        cout<<endl<<"Pr ess enter to continue...."<< endl;
        getch();

        Comment

        Working...