Monday, September 14, 2020

Programming in C++ WEEK 1 NPTEL(JULY-DEC 2020) ASSIGNMNET SOL.

 Question 1 :

stack<char> s;    // LINE-1    



    for (int i = 0; i < strlen(str); i++)


        s.push(str[i]);    // LINE-2


Question 2 :

bool StrCmp(string s1, string s2) {


    if (s1.length()>s2.length() || s1.length()<s2.length())    // LINE-1

    

        return 1;    // LINE-2

    else

        return 0;    // LINE-3

}


Question 3 :

typedef void (*Fun_Ptr)(int,int); // LINE-1


Fun_Ptr fp = &add; // LINE-2

2 comments: