Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Consider the following pseudocode:
declare a stack of characters
while ( there are more characters in the word to read )
{
read a character
push the character on the stack
}
while ( the stack is not empty )
{
write the stack's top character to the screen
pop a character off the stack
}
write c++ code for above

Given an integer number N as input. Write a program to print the double triangular pattern of N lines using an asterisk(*) character as shown below.


In s bank there are two types of transactions credit and debit

write c++ statements to declare an integer variable score and a double constant TARGET. initialize them with 15 and 20.0 respectively?


Design a recursive algorithm to search a sorted array a for an element x between a[low] and
a[high]. If no element is found it returns -1. Also, analyse the time and space complexity of your
algorithm.
Write a program that inserts 25 random integers from 0 to 100 in sorted order in a linked list.
The program should calculate the sum of the elements and the floating-point average of the
element
L=int(input())
count=0
for a in range(1,L-1):
    for b in range(a+1,L):
        for c in range(b+1,L+1):
            x=a*a
            y=b*b
            z=c*c
            if (x+y==z):
                count+=1




print(count)

What is the trick behind this problem



Given a string, an integer position, and a character, all on separate lines, find the character of the string in that position and replace it with the character read. Then, output the result.

Ex: If the input is:

warn


e

the output is:

earn

Note: Using a pre-defined string function, the solution can be just one line of code.


#include <iostream>

#include <string>

using namespace std;


int main() {

  string stringVal;

  int stringPos;

  char substituteChar;

  

  getline(cin, stringVal);

  cin >> stringPos;

  cin >> substituteChar;


  


  cout << stringVal << endl;


  return 0;

}


Maximum

You are given N number of inputs. Print the maximum of them after each input.

Input

The first line of input is an integer N. The next N lines each contain an integer as input.

Explanation

In the example, you are given

6 inputs 1, 0, 3, 2, 9, 8.

1 is maximum in the input 1.

1 is maximum in the input 1, 0.

3 is maximum in the input 1, 0, 3.

3 is maximum in the input 1, 0, 3, 2.

9 is maximum in the input 1, 0, 3, 2, 9.

9 is maximum in the input 1, 0, 3, 2, 9, 8. 

So, the output should be

1

3

3

9

9

Sample Input 1

6

1


3

2

9

8

Sample Output 1

1

1

3

3

9

9

Sample Input 2

5

1

2

3

4

5

Sample Output 2

1

2

3

4

5


Hollow Rectangle - 2

Write a program to print a rectangle pattern of M rows and N columns using the characters as shown below.

Input

The first line of input is an integer M. The second line of input is an integer N.

Explanation

In the given example, 3 rows and 10 columns.

Therefore, the output should be


+----------+

| |

| |

| |

+----------+


Sample Input 1

3

10

Sample Output 1

+----------+

| |

| |

| |

+----------+

Sample Input 2

5

10

Sample Output 2

+----------+

| |

| |

| |

| |

| |

+----------+




LATEST TUTORIALS
APPROVED BY CLIENTS