by CodeChum Admin
Most, if not all things have numeric values. That goes for characters too. In order to find out which character has a higher value, we have to compare them with each other and display the value of the higher character.
Instructions:
Input
1. First character
2. Second character
Output
Enter·first·character:·a
Enter·second·character:·h
Result·value·=·104
by CodeChum Admin
My friends are geeking out with this new device I invented. It checks if a number is even or odd! 🤯
Do you want to try it out?
Instructions:
Input
1. Integer n
2. N integer values
Output
Enter·n:·5
Enter·value·#1:·3
3·is·odd
Enter·value·#2:·6
6·is·even
Enter·value·#3:·4
4·is·even
Enter·value·#4:·1
1·is·odd
Enter·value·#5:·3
3·is·odd
by CodeChum Admin
The only constant thing in the world is change. That’s why we need to call the toupper() function to change what we already have into a better version.
Instructions:
Input
1. Letter to be updated
Output
Enter·a·small·letter:·a
Uppercase·=·A
by CodeChum Admin
Let’s try to find out whether a year has 365 or 366 days. To do this, we need to create a leap year detector!
Conditions for a leap year:
1.) year must be divisible by 4 and not divisible by 100
2.) If year is divisible by 100, it must be divisible by 400 for it to be a leap year.
Instructions:
Input
1. Year to be checked
Output
If a certain year is a leap year, print "<INSERT_YEAR_HERE> is a leap year"
Otherwise, print "<INSERT_YEAR_HERE> is not a leap year"
Enter·year:·2020
2020·is·a·leap·year
Preserving the Gene Pool
by CodeChum Admin
In order to make sure that the future generations will grow into great beings, we must make sure that the gene pool consists of the best genes. In order to do that, we must compare genes from each other and find out which one is the best!
Instructions:
In the code editor, you are provided with a main() function that asks the user for 4 integer inputs and passes these to the getBest() function call.
Your task is to declare and define this getBest() function which has the following details:
Return type - int
Name - getBest
Parameters - 4 integers
Description - returns the highest integer passed
DO NOT EDIT ANYTHING IN THE MAIN
Input
1. First integer
2. Second integer
3. Third integer
4. Fourth integer
Output
Enter·a:·10
Enter·b:·3
Enter·c:·15
Enter·d:·14
Highest·integer·=·15
Pairing Up
by CodeChum Admin
You’re tasked with pairing up people with each other but you need to figure out how well both of them work together. In order to find out how effective each pair is, you need to create a program that adds both of their values and returns their sum.
Instructions:
In the code editor, you are provided with a main() function that asks the user for two integer inputs, passes these to a function called, getSum(), and then prints the returned value.
Your task is to declare and define the getSum() function which has the following details:
Return type - int
Name - getSum
Parameters - 2 integers
Description - adds the passed integers and returns their sum
DO NOT EDIT ANYTHING IN THE MAIN
Input
1. First integer
2. Second integer
Output
Enter·first·number:·24
Enter·second·number:·21
Sum·=·45
Problem:
Compute and display the output of the Area (A) of a rectangle, based on
inputted value for length (L) and the width (W).
Formula: A = L * W
Write a program to create a class students having name , id , age. Create a file "student.txt" and open in append mode. Write details of 3 students into a file and read the data from the file and display on screen. Also copy content to this file into another file. [10 marks]
Qn.Implement a super class Person. Make two classes, Student and Instructor, that inherit from
Person. A person has a name and a year of birth. A student has a course and an instructor has a
salary. Write the class definitions, the constructors, and the functions for all classes. Supply a test
program that test these classes and member functions.
Write a C++ program which performs the following two operations on doubly linked list
Insertion of a new element at any mentioned position in the list.
Deletion of an element which contains the given key
Deletion of an element which found at the given position.