Consider the following function definition:
int func(int x, double y, char u, string name) {
//function body
}
Which of the following are correct function prototypes of the function func?
a. int func(x, y, u, name);
b. int func(int s, double k, char ch, string name);
c. int func(int, double, char, string);
d. func(int, double, char, string
The tap code, sometimes called the knock code, is a way to encode text messages on a letter-by-letter basis in a very simple way. Tap code has been one of the most basic communication protocols and still used to convey SOS messages and other urgent communication. The tap code uses a 5×5 grid of letters representing all the English alphabets, see Figure 1. To communicate the word "water", the cipher would be the following (with the pause between each number in a pair being shorter (single space) than the pause between letters (two spaces)),
A B C/K D E
F G H I J
L M N O P
Q R S T U
V W X Y Z
Your task is to design a program that can
i) convert any given string into a Tap code sequence
Prototype: char* convertToTapCode(char*)
ii) and A Tap code sequence to a string (char*)
Prototype: char* convertToString(char*)
Note:
1) only use following library :
#include <iostream>
Note: however, you can use char*
helping link
http://yamm.finance/wiki/Tap_code.html
In a car race game, when a car object is created it should be filled with fuel, and placed at certain x,y coordinates. Once the game is over, all cars should be deleted ? How do you handle it using c++ classes. Write suitable c++ code
This program will read integers from a file and find results from these integers.
Open the file, test to make sure the file opened. Use a loop to read the integers and process each integer as it is read. When End Of File is reached, close the file.
After all of the integers have been read and processed, print the results for the following output:
Use notepad, vim, or other simple text editor to create a file named file1.txt containing the following, with one integer per line.
Test the program two times.
Use the following data in the first test:
11
9
18
22
27
33
21
For the second test add an additional line containing the number 40.
Write a Program: Compute an average of integer values
Ask the user to enter a number of values to average in the range from 2 to 10. Use a loop to make sure the entered number is within the range. Output an error message any time an invalid number is entered. Once a valid number of values is entered ask the user to input each value. Enumerate the values being asked for (see the output example). Your goal is to calculate their average and output it to the console.
Your output should look similar to the following:
First run
Enter a number of values from 2 to 10: 1
Invalid input!
Enter a number of values from 2 to 10: 11
Invalid input!
Enter a number of values from 2 to 10: 6
Enter value 1: 5
Enter value 2: 8
Enter value 3: 45
Enter value 4: 11
Enter value 5: 6
Enter value 6: 1
The average is 12.667
Second run
Enter a number of values from 2 to 10: 4
Enter value 1: 41
Enter value 2: 55
Enter value 3: 12
Enter value 4: 9
The average is 29.250
Writing a small program for Bank Management System.
In this program, we are using the concept of C++ class and object, following basic
operations are being performed:
• Deposit
• Withdraw
In this program, we have created a class Bank with the following member functions:
• Deposit() – It will ask for the amount to be added in available balance, and deposit
the amount.
• Withdrawal() – It will ask for the amount to be withdrawn from the available, will
also check the available balance, if balance is available, it will deduct the amount
from the available balance.
2. Three is a Crowd
by CodeChum Admin
This one’s pretty simple as well, but I hope you haven’t forgotten how to create a new line!
Instructions:
Input three random characters and make sure they are inputted on different lines.
Print out the three strings in order, each on a different line, using only 1 std::cout statement and newline characters (\n). An initial code with 1 std::cout is already provide for you. Don't add more std::cout's!
Input
Three lines containing a character on each.
A
B
C
Output
Three lines containing a character on each.
A
B
C
3. Input + Addition
by CodeChum Admin
Hopefully you haven't forgotten about your previous lesson, because you're going to need it for this one.
Instructions:
Input two integers (one per line) and make sure to store them in variables.
Add the two integers and print out their sum!
Input
Two lines containing an integer on each.
6
6
Output
A line containing the addition of the two inputted integers.
12
Code
4. Decimal x Decimal
by CodeChum Admin
Now that we're done with integers, we're moving on to decimals!
Instructions:
Input three decimal numbers in one line separated by spaces, and make sure to store them in different variables.
Multiply the 1st and 2nd decimal numbers, and store the product into a variable.
Then, divide the product of the 1st and 2nd decimal numbers with the 3rd decimal number, then print out its quotient, with 2 decimal places.
Input
A line containing three decimal numbers with two decimal places separated by a space.
*Test Case 1
1.53·2.25·1.23
Output
A line containing the result with two decimal places.
2.80
*Test Case 2
Input
1.9 2.5 3.75
Expected Output
1.27
First, read in an input value for variable numInput. Then, read numInput integers from input and output each integer on a newline after the string "input = ".
Ex: If the input is 2 30 40, the output is:
input = 30
input = 40