Consider the code snippet given below:-
[Assume the necessary header files and namespaces included]
int main()
{ int a[10];
cout<<”enter the elements of the array\n”;
for(int i=0;i<10;i++)
cin>>a[i];
return 0;
}
Complete the code such that the even and odd numbers from the array ‘a’ are stored into two different arrays. The size of these arrays should be same as that of the number of elements and their memory should be deallocated after displaying the odd and even numbers.
Class Template – Array
Write a C++ program to create a class template using an array. Perform operations like sorting, searching, and displaying the array using a class template.
A class named Array with the following member variables.
Data TypeVariable NameIntegersizeT*array
Function NameDescriptionvoid sorting() This function is used to sort the array elements in ascending order and display the array.void search(T &search) This function is used to search the array element, if the element is found display "Element found at position x" else print "Element not found"
Sample Input and Output 1:
Menu
1.Sorting integer array
2.Searching array of double values
Enter your choice:
1
Enter size of array:
3
Enter the array elements:
5
2
55
Sorted array
2
5
55
Your horse has to have 1 ounce of probiotic supplement a day. You can buy it per
pound, as a 10 lb pail at a 10% discount, or as a 20 lb pail at a 15% discount. Your
goal is to produce formatted output showing the daily cost for each buying
option. You should ask the user to enter the price per lb.
Your horse has to have 1 ounce of probiotic supplement a day. You can buy it per
pound, as a 10 lb pail at a 10% discount, or as a 20 lb pail at a 15% discount. Your
goal is to produce formatted output showing the daily cost for each buying
option. You should ask the user to enter the price per
Develop an OOP program to maintain a list of homework
assignments. When an assignment is assigned, add it to the list, and when it is
completed, remove it. You should keep track of the due date. Your program should
provide the following services:
• Add a new assignment.
• Remove an assignment.
• Provide a list of the assignments in the order they were assigned.
• Find the assignment(s) with the earliest due date.
create a class called assignments to complete the task and use STL to implement the
linked list. compile and run your project and test all the methods.
Write a C++ program that compute the given formula below