An electricity board charges the following rates to domestic users to
discourage large consumption of energy.
For the first 100 units − 50 P per unit
Beyond 100 units − 60 P per unit
If the total cost is more than Rs.250.00 then an additional surcharge of
15% is added on the difference. Define a class Electricity in which the
function Bill computes the cost. Define a derived class More_Electricity
and override Bill to add the surcharge.
Write a program that declares two classes. The parent class is called Simple that has
two data members num1 and num2 to store two numbers. It also has four member
functions.
The add() function adds two numbers and displays the result.
The sub() function subtracts two numbers and displays the result.
The mul() function multiplies two numbers and displays the result.
The div() function divides two numbers and displays the result.
The child class is called Complex that overrides all four functions. Each function in
the child class checks the value of data members. It calls the corresponding member
function in the parent class if the values are greater than 0. Otherwise it displays
error message.
Write a program having a base class Student with data members
rollno, name and Class
define a member functions getdata() to input values and another
function putdata() to display all values. A class Test is derived from class
Student with data members T1marks, T2marks, T3marks, Sessional1,
Sessional2, Assignment and Final. Also make a function getmarks() to
enter marks for all variables except Final and also make a function
putmarks() to display result. Make a function Finalresult() to calculate
value for final variable using other marks. Then display the student
result along with student data.
The following pseudocode describes how to swap two letters in a word. We are given a string str and two positions i and j. (i comes before j) Set first to the substring from the start of the string to the last position before i. Set middle to the substring from positions i + 1 to j - 1. Set last to the substring from position j + 1 to the end of the string. Concatenate the following five strings: first, the string containing just the character at position j, middle, the string containing just the character at position i, and last. Check this pseudocode, using the string "Gateway" and positions 2 and 4. Draw a diagram of the string that is being computed,
design a c++ program with using and without using virtual function getdata() and putdata() to read and display the details of student such as sname,sregno and address?
Write a program that reads lines of text and appends them to a char buffer[1000]. Stop after reading 1,000 characters. As you read in the text, replace all newline characters '\n' with '\0' terminators. Establish an array char* lines[100], so that the pointers in that array point to the beginnings of the lines in the text. Consider only 100 input lines if the input has more lines. Then display the lines in reverse order, starting with the last input line.
You have given an array A containing N integers. You can do the following operation at most K times:
• Choose any index i and increase the value of At by 1.
Your task is to find the maximum bitwise OR of the array.
Input format
• The first line contains an integer T denoting the number of test cases.
• The first line of each test case contains two space-separated integers N and K.
• The second line of each test case contains N space-separated integers denoting array A.
Output format
For each test case, print the maximum possible bitwise OR of the array after performing at most K operations in a new line.
Constraints
1 ≤ T ≤ 100000 1 ≤ N ≤ 200000
O ≤ K ≤ le18
It is guaranteed that the sum of N over T test cases does not exceed le6.
Explanation
For the first test case, we can increase the value of the 5-th index by 2. Thus the A becomes {1, 3, 7, 0, 8, 1}. The bitwise OR of array A becomes 15.
Population limit: 20792
Note: Population limit will change at random intervals. So please make sure answer is computed for the correct population limit before submitting.
Write a program that accepts five numbers from the user and displays the values from lowest to highest. Assume that there are no duplicate values.
String processing
You are given a dictionary that maps all lowercase English alphabets from
'a' to 'z' to either lor -1.
For a string of length k, you perform the below operation:
• Find the maximum character from index Ito k, and find the dictionary mapping of the respective maximum character.
• If dictionary mapping is 1, increment all characters from Ito k.
• 'a' becomes 'b', 'b' becomes 'c', . 'z' becomes 'a'.
Task
Determine the count of each lowercase English alphabet after N operations.
For Full Instructions and Note Please Use Those Images as reference... Please help
https://drive.google.com/file/d/1QVE-utPuKxxxah3P5T5geL93MX1G5vy_/view?usp=sharing
https://drive.google.com/file/d/1b3RT2IBIBMG2Ojob6uGqoDglXHg-Z928/view?usp=sharing