Description:
A palindrome is a string, which when read in both forward and backward ways is the same.
Example: lol, pop, radar, madam, etc.
To check if a string is a palindrome or not, a string needs to be compared with the reverse of
itself.
Demonstrate these two functions in a program that performs the following steps:
1. The user is asked to enter a string.
2. The program displays the following menu:
A) Display the reverse of the string
B) Check the string is palindrome or not
C) Exit the program
3. The program performs the operation selected by the user and repeats until the user
selects E to exit the program.
Output:
Enter a string : madam
Please enter a choice according to menu:
A) Display the reverse of the string
B) Check the string is palindrome or not
C) Exit the program
Please enter choice: A
The reverse of the string is : madam
Please enter choice: B
Madam is palindrome
Please enter choice: E
Terminate the program
A RACE CAR HAS A MASS OF 710 KG. IT STARTS FROM REST AND TRAVELS 40 M IN 3 S. THE CAR IS UNIFORMLY ACCELERATED DURING THE ENTIRE TIME. WHAT NET FORCE IS APPLIED TO IT ?
A 10 KG BLOCK LIES ON A FRICTIONLESS HORIZONTAL SURFACE.
A. WHAT FORCE WILL GIVE IT AN ACCELERATION OF 500 CM/S2 ?
B. WHAT CONSTANT FORCE WILL GIVE THE SAME BODY A VELOCITY OF 2 M/S AFTER 1 S ?
A 2.5 KG MASS AND A 4 KG MASS ARE ATTACHED TO A LIGHT WEIGHT CORD THAT PASSES OVER A FRICTIONLESS PULLEY. THE HANGING MASSES ARE LEFT FREE TO MOVE. FIND THE
A. ACCELERATION
B. TENSION OF THE CORD
A 5000 KG TRUCK IS RUNNING AT 72 KPH.
a. ) IF IT IS TO BE STOPPED BY A CONSTANT RETARDING FORCE IN 10 S. WHAT IS THE DECELERATION ?
b ) WHAT IS THE RETARDING FORCE ?
How to execute this using vector?
#include <iomanip>
#include <iostream>
using namespace std;
int main() {
const int MAXCNT = 10; // Constant
float arr[MAXCNT], x; // Array, temp. variable
float array2[MAXCNT];
int i, cnt; // Index, quantity
cout << "Enter up to 10 numbers \n"
<< "(Quit with a letter):" << endl;
for (i = 0; i < MAXCNT && cin >> x; ++i)
arr[i] = x;
cnt = i;
// copying elements of an array to another
// array2 = arr
for (int index = 0; index < cnt; index++)
array2[index] = arr[index];
cout << "The given numbers:\n" << endl;
for (i = 0; i < cnt; ++i)
cout << setw(10) << arr[i];
cout << endl;
return 0;
}
Perform the following operations
A. Write the 2's compliment of the following number: 10111110
B. Write the 8's compliment of the following number: 763 (1)
C. Write the 7's compliment of the following number: 476 (1)
D. Write the 15's compliment of the following number: FDB96
E. Write the 10's compliment of the following number: 96099
A family has four children. If x is a random variable that pertains to the number of female children, what are the possible values of x
Drive an expression for band structure of an open circuit PN junction. Consider the PN junction at 300K with doping concentration N d =2*10^ 15 cm^ -3 and N a =1.5*10^ 18 cm^ -3 in the P and N side of junction respectively. Determine the contact potential across the junction. Assume that intrinsic concentration of germanium is n i =2.5*10^ 13 cm^ -3 at 300K.
Let x be a random variable that denotes the number of passenger in a train station for a given hour. What are the possible values of x