NPTEL( 14 Sep - 06 Nov ) | Week 1 Programming Qs1 and Programming Qs2 Programming in CPP 2020

  



       Programming in C++       




W1_Programming-Qs 1:


Consider the following code snippet. Fill in the blank at LINE-1 to create a stack and at
LINE-2 to fill the stack with the value of array str. Look into the test cases to validate the outputs. 

PROGRAM:

 stack <char> s;    // LINE-1    


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

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

W1_Programming-Qs 2:


Consider the following code snippet. Fill in the blank at LINE-1 to create a stack and at
LINE-2 to fill the stack with the value of array str. Look into the test cases to validate the outputs. 

PROGRAM:

#include <iostream>
#include <string>
using namespace std;

bool StrCmp(string s1, string s2) {

    if (s1.length()==s2.length())    // LINE-1
    
        return 0;    // LINE-2
    else
        return 1;    // LINE-3
}

FOLLOW OUR WEBSITE FROM THE BUTTON PROVIDED TO THE BOTTOM OF PAGE TO GET SOON ANSWERS OF PROGRAMS.
Disclaimer: Here you can find all nptel assignment solutions related to CS stream.These may help you for your assignment.The answers are only for verification.You cannot copy these directly from the post(code of conduct of NPTEL).These is not 100%  correct solutions.

No comments:

Post a Comment

If you have any problems related to solutions or any concept please let me know.

Copyright (c) 2020 Custom Programs All Right Reserved

Pages