Often some situation arises in programming where data or input is dynamic in nature, i.e.
the number of data item keeps changing during program execution. A live scenario where the
program is developed to process lists of employees of an organization. The list grows as the
names are added and shrink as the names get deleted. With the increase in name the memory
allocate space to the list to accommodate additional data items. Such situations in programming
require which technique. Explain the concept with the help of suitable examples.
Write a program to create a base class: “Question3”, with protected data member: x (int) and
with pure virtual function: “Task ()” [Returns no value and takes no argument]. Create a derived
class of “Question3” such as “Sub1” (Derive features in public mode). In sub1, there is a
member function in public section: get_data1 () to take input for x, and define Task () in this
class to display the reverse of x. [Implement the above program by creating pointer to base in
main () function and call the necessary functions].
. Create a class Student with following data members, name, roll, and marks as private data
member. Create array of objects for three students, compare their marks but make sure
allocating memory to all the objects during run time only and display the records of the student
who is getting highest score.
. Create a class: “Question 1” with data members: 1D integer array of maximum size: 100, n
(int). Create a dynamic constructor which takes input of n and n no. of array elements. Apart
from taking input this class also displays the maximum and minimum elements from the given
array elements.
#include <iostream>
class Question3
{
public:
virtual void Task1() = 0;
protected:
int x;
};
class Sub1: public Question3
{
public:
void get_data1()
{
std::cout<<("Enter x: ");
std::cin >> x;
}
void Task1()
{
if (x == 0)
{
std::cout << "0 has no inverse number " << std::endl;
}
else
{
std::cout << 1.0/x<< std::endl;
}
}
};
int main()
{
Sub1 sub;
Question3* q = ⊂
sub.get_data1();
q->Task1();
return 0;
}
in this code. in the int main() section. q=c is there, what is that special character c.
it is not c right?
Write down the Boolean Table AND the Boolean Expression that models
the circuit that engineers two light switches A and B at the two EXITS
of a huge conference center. The specifications are as follows:
(a)Both light switches operate the one common light in the room.
(b) The light is off when both switches A and B are OFF. That would
mean that A = B = 0 implies the light is OFF = 0.
(c) Flipping either switch will turn the light ON = 1.
(d) Following (c) flipping either switch will turn the light OFF = 0.
(e) We can go back and forth between (c) and (d). Flipping either
switch A or B will turn the light OFF = 0 if it is ON = 1 and ON = 1
if it is OFF = 0
Abhinav and Anjali are playing Rock-Paper-Scissors game. Rock-Paper-Scissors is a hand game usually played between two people, in which each player simultaneously forms one of three shapes with an outstretched hand. These shapes are "rock", "paper" and "scissors". Based on the shapes the player chooses the outcome of the game is determined. A rock beats scissors, scissors beat paper by cutting it, and paper beats rock by covering it. If the same shape is chosen by both of the players, then it is a tie. Write a program to decide the winner of each round of the game based on the shapes the players chose.
Given Inputs:
code and explanation for this question
The given question is (Given a string in camel case, write a python program to convert the given string from camel case to snake case.)
Given inputs
I need code and explanation for this question........?
Add two polynomials
Given two polynomials A and B, write a program that adds the given two polynomials A and B
The first line contains a single integer M.
Next M lines contain two integers Pi, Ci separated with space, where Pi denotes power and Ci denotes co-efficient of Pi for polynomial A.
After that next line contains a single integer N.
Next N lines contain two integers Pj, Cj separated with space, where Pj denotes power and Cj denotes co-efficient of Pj for polynomial B.Output
Print the addition of polynomials A and B.
If the degree of polynomial is zero and the constant term is also zero, then just print 0 to represent the polynomial.
For term Cix^Pi, if the coefficient of the term Ci is 1, simply print x^Pi instead of 1x^Pi.Explanation
Sample Input
6
0 -20
1 23
2 30
3 19
4 6
5 17
9
0 -100
5 -89
6 -20
7 -1
1 20
2 4
3 99
4 -45
8 12
Sample Output
12x^8 - x^7 - 20x^6 - 72x^5 - 39x^4 + 118x^3 + 34x^2 + 43x - 120
Pele needs a program to calculate his bank balance at the end of the month. Get his balance at the beginning of the month and his deposit and withdrawal amounts during the month. Bank costs are fixed at R55.66 per month. Calculate and display his balance at the end of the month.
What is the second step of the button calculate event procedure?