Write a C++ program to find the table of numbers using a while loop. Your program should ask the size of the table. That size defines the rows and columns.
Explain how overloading a unary operator is almost similar to overloading a binary operator with necessary examples and include main() function to demonstrate. Mention the differences between these two in terms of number of operands they deal with.
Explain how overloading a unary operator is almost similar to overloading a binary operator with necessary examples and include main() function to demonstrate. Mention the differences between these two in terms of number of operands they deal with.
There is a Ground class that keeps the ground name and city. There is another class Game, that holds information on game names and the date of the game on which the game will be played. The Player class keeps the information about a Player, name, and code. There is a Team class that holds the team name and the total number of players counted.
In a cricket game, a team can have 11 players including 1 captain. The Game will be played between 2 teams on the ground. No player can play the game without a team on the ground. And no game can be played without a ground’s information.
Design it using any possible type of Inheritance. Input information for a game of 2 teams, and display the following:
Ground name City Game Team1 Team2 Captain1 Captain2.
A customer opens an account at a bank with an initial amount. The account number, name, and balance of the customer are generated. The customer can deposit money and withdraw money as per need, this will modify the existing account balance. It should also be checked if the demanded amount is available during withdrawal. The customer can also close the account, the available amount will be paid out. Write a programme to input and display data for 5 customers with the use of Constructor and Destructor
Make a file by yourself named ”Integer.txt” and add 5 integer values in it. Now, write a C++ program that reads data (5 integers) from the file and store them in integer array. Also make another integer array (int result []) of same size to store the results. The program should check for each number in array if it is prime number or not. If the number is prime, update value in result[] array from 0 to 1. Lastly, write output in another file named “Result.txt”
by CodeChum Admin
There are different kinds of numbers, but among them all, the most commonly used numbers in our daily lives are those positive ones. So, I only want you to count all the positive numbers from the 4 outputted values and print out the result.
Go and search for the positive ones among these four!
Define a function CalcPyramidVolume with double data type parameters baseLength, baseWidth, and pyramidHeight, that returns as a double the volume of a pyramid with a rectangular base. Relevant geometry equations:
Volume = base area x height x 1/3
Base area = base length x base width.
(Watch out for integer division).
Where's the Biggest One?
by CodeChum Admin
We've already tried comparing 3 numbers to see the largest among all, so let's try a more complicated mission where we locate the position of the largest among 5 numbers. There are only 4 possible cases for this mission:
- if the largest digit is the first digit, print "Leftmost"
- if the largest digit is the third digit, print "Middle"
- if the largest digit is the last digit, print "Rightmost"
- if none of the above is correct, print "Unknown"
Now, show me how far you've understood your lessons!
Make a file by yourself named ”Integer.txt” and add 5 integer values in it. Now, write a C++
program that reads data (5 integers) from the file and store them in integer array. Also make another
integer array (int result []) of same size to store the results. The program should check for each number
in array if it is prime number or not. If the number is prime, update value in result[] array from 0 to 1.
Lastly, write output in another file named “Result.txt”
Example
Input:
Integer.txt
2 11 1 17 8
Output:
Result.txt
1 1 0 1 0
Hint: Prime number are those which is only divisible by 1 or itself.