Given a string, write a program to print a secret message that replaces characters with numbers 'a' with 1, 'b' with 2, ..., 'z' with 26 where characters are separated by '-'.
Note: You need to replace both uppercase and lowercase characters. You can ignore replacing all characters that are not letters.
abcdefghij12345678910
klmnopqr1112131415161718
stuvwxyz1920212223242526
For example, if the given input is "python", "p" should replaced with "16", similarly"y" with "25","t" with "20","h" with "8","o" with "15","n" with "14". So the output should be "16-25-20-8-15-14".
Sample Input 1
python
Sample Output 1
16-25-20-8-15-14
Sample Input 2
Foundations
Sample Output 2
6-15-21-14-4-1-20-9-15-14-19
Create a time class having data members hour, minute and second. Make a constructor to set the members zero, make a display function that outputs the time in given format: 00:00:00. Make a function called ticktick() that increments the time in such a way that hour do not change till the minutes and seconds ends at 60. (01:01:01…. 01:59:59 -> 02:00:00). Design the main function, create an object and call the functions accordingly.
calculate daily sales for each item in the café for a week.
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.
Write a complete C program that should be able to read ten alphabets between A, B and C from users. The program should then display a list of all entered alphabets and the total number of each alphabet. You are required to write the program by applying the modular programming concept as have been taught in the class. A list (an array) to store 10 characters should be created in the main function and as part of the program, you are required to:
a) Define a function named readAlpha() to read all the 10 alphabets from the user.
b) Define a function named listAlpha() to display all the entered alphabets as a list.
c) Define a function named findTotal() to count and display the total number for each alphabet entered. Also determine which alphabet has the highest number of hit then return the result to the main function and print the result from the main function.
1.Ask user to enter three words. You can assume that each word has the maximum
length of five characters.
2. Combine the three words to form a passphrase. For example, if the user enters the
words “I”, “love” and “you”, the passphrase should be “Iloveyou”.
3. Ask user to enter a passphrase. Check whether the passphrase entered by the user is
the same as the passphrase generated in Step 2 above. If the passphrase entered is
the same, prints out “Passphrase is correct!”. Otherwise, prints out “Wrong
passphrase!”.