Home / C++ Programming / Functions - C++ :: Discussion

Discussion :: Functions - C++

  1. What will be the output of the following program?

     #include
     #include  
     class Freshergate
     {    
         char txtMsg[50];   
         public:     
         Freshergate(char *str = NULL)    
         {   
           if(str != NULL)          
             strcpy(txtMsg, str);  
         }  
         int GateFunction(char ch); 
     }; 
     int Freshergate::GateFunction(char ch) 
     {    
         static int i = 0;   
         if(txtMsg[i++] == ch)     
            return strlen((txtMsg + i)) - i;     
         else     
            return GateFunction(ch); 
      } 
      int main() 
      {   
      Freshergate objGate("Welcome to    
      Freshergate.com!");  
      cout't');     
      return 0;
     }
    

  2. A.

    6

    B.

    8

    C.

    9

    D.

    15

    E.

    16

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    No answer description available for this question.


Be The First To Comment