Your task is to define the sendApology() function with the following details:
a. Return type - void
b. Function name - sendApology
c. Parameters - a character and an integer.
The sendApology() function will first check if the character passed is either 's', 'o', 'r', or 'y'. If it is, print it based on the passed integer number of times. For example, if the passed integer is 5, then you need to print the character 5 times. Otherwise, just ignore it (i.e. don't do anything).
Do not edit the main() code.
This is the given code:
#include <iostream>
using namespace std;
int main(void) {
sendApology('s', 2);
sendApology('f', 10);
sendApology('b', 3);
sendApology('o', 5);
sendApology('r', 12);
sendApology('m', 5);
sendApology('v', 2);
sendApology('y', 7);
return 0;
}
void sendApology(char letter, int n) {
// TODO: Implement the function definition
}
Vowels Survival
by CodeChum Admin
Make me a program that accepts two random strings. Then, count the number of vowels that are in each of the strings and put it on separate variables.
Finally, for the survival of the vowels, subtract the total count of vowels of the first string to the vowels of the second string then print out its difference.
Easy, right? Then go and code as if your life depends on it!
Input
Two lines containing a string on each.
C++·is·fuN CodeChum·is·AWEsome
Output
A line containing an integer.
6
Search and Rescue
by CodeChum Admin
Make a program that will accept an integer and loop for the same number of times as that of the inputted integer and input random integers and add it to the array/list one by one, per line. Afterwards, make your program accept another random integer.
Using that final integer, compare from your array/list if the final integer's value is also present in your current array/list. If so, print "Present"; otherwise, print "None".
Start coding now!
Input
The first line contains the size of the array. The next lines contain the integers. The last line contains an integer to be searched.
5 3 21 2 5 23 2
Output
A line containing a string.
Present
We Filipinos are quite known for the habit of leaving at least one of the many pieces of food on the plate as it can't be equally divided among all at most times. Just like when 3 people decide to eat a pizza of 10 slices, there will often be at least one slice left on the box. To accurately show just how many pieces of things are left when divided by a certain number, we code it using modulo.
Care to do it for me?
Input
1. First integer
2. Second integer
Output
The first line will contain a message prompt to input the first integer.
The second line will contain a message prompt to input the second integer.
The last line contains the remainder.
Enter·the·first·integer:·10
Enter·the·second·integer:·3
Remainder·=·1
Consider a problem of an agent depositing an already issued book in library and then issuing a new book. List:
(i) predicates
(ii) actions
(iii) pre-conditions
(iv) effects for the aforementioned planning problem.
We Filipinos are quite known for the habit of leaving at least one of the many pieces of food on the plate as it can't be equally divided among all at most times. Just like when 3 people decide to eat a pizza of 10 slices, there will often be at least one slice left on the box. To accurately show just how many pieces of things are left when divided by a certain number, we code it using modulo.
Care to do it for me?
Input
1. First integer
2. Second integer
Output
The first line will contain a message prompt to input the first integer.
The second line will contain a message prompt to input the second integer.
The last line contains the remainder.
Enter·the·first·integer:·10
Enter·the·second·integer:·3
Remainder·=·1
3. Leftovers
by CodeChum Admin
We Filipinos are quite known for the habit of leaving at least one of the many pieces of food on the plate as it can't be equally divided among all at most times. Just like when 3 people decide to eat a pizza of 10 slices, there will often be at least one slice left on the box. To accurately show just how many pieces of things are left when divided by a certain number, we code it using modulo.
Care to do it for me?
Input
1. First integer
2. Second integer
Output
The first line will contain a message prompt to input the first integer.
The second line will contain a message prompt to input the second integer.
The last line contains the remainder.
Enter·the·first·integer:·10
Enter·the·second·integer:·3
Remainder·=·1
you will load the training and test sentiment datasets "twitdata_TEST.tsv" and "allTrainingData.tsv". The data should be loaded into 4 lists of strings: X_txt_train, X_txt_test, y_test, y_train.
SWAP CASE:
Explantion:
In the first example S=abc and T=acb.Arjun can swap the 2nd and 3rd characters of S to make S and T equal.Hence ,the output is Yes
i/p:
abc
acb
o/p:Yes
Your task is to implement the class Loan with the following requirements:
• A member variable that will hold the annual interest rate of the loan. Its default value will be 2.5.
• A member variable that will hold the number of years for the loan. Its default value will be 1.
• A member variable that will hold the loan amount. Its default variable will be 1000.
• A default constructor.
• Another constructor that has interest rate, years, and loan amount as its parameters.
• A member function that returns the annual interest rate of this loan.
• A member function that returns the number of the years of this loan.
• A member function that returns the amount of this loan.
• A member function that sets a new annual interest rate to this loan.
• A member function that sets a new number of years to this loan.
• A member function that sets a new amount to this loan.
• A member function that returns the monthly payment of this loan.
• A member function that returns the total payment of this loan.