Write aprogramm using Array 1,2,3,4,5 and insert middle 5,6 and delete 3
Write a program that prompt the
user to enter a number and determines whether the entered number is a perfect number. Your
program should determine and print all the perfect numbers between 1 and 1000. Print the
divisors of each perfect number to confirm that the number is indeed perfect.
Write a C++ program to obtain the given output:
Enter any number or enter 0 to exit: 8
Enter your choice, star[s] and hash[h]: h
########
Enter any number or enter 0 to exit: 4
Enter your choice, star[s] and hash[h]: s
****
Enter any number or enter 0 to exit: 0
Are you sure you want to exit? (Y/N): Y
Thank you for using this program. Have a good luck!
Press any key to continue . . .
Write a C++ FUNCTION named getData()that prompts the user to enter results for a
number of students passed to it using the following data structure: (5 MARKS)
struct result
{
string name;
int matNum;
double mark;
};
Write a C++ program to find roots of a quadratic equation using Ternary conditional operator.
1.6) Enter the code
void Hello()
{
printf("Hello world\n");
}
int main(int argc, char *argv[])
{
Hello();
system("pause");
return 0;
}Add the output of this program to your logbook
• You should be able to appreciate that functions can be used to prevent code duplication. Write a short reflective account of the code concentrating on its functionality and comparing the outputs against the source code.
Write a program in c++ to read the radius of a circles and prant its area
Consider a class representing a ClubSandwich. A sandwich is made of some number of bread slices, cheese slices, meat patties and tomato slices. The club sandwich might also contain (or not) mustard, ketchup, iceburg. The sandwich may or may not be grilled.
Different composition of the sandwich will cost different prices according to what it contains.
A parameterized constructor that takes argument for each of these variables and initializes them accordingly
Provide a method calculatePrice() that calculates and returns the price of this sandwich according to the rates given in the above table. E.g
3 * 20 + 2 * 30 + 2 * 5 + 3 * 70 + 5+ 0 + 0 + 10
Provide a method applyDiscount(double disc) that calculates the price, applies the discount % given in the argument and returns the discounted price of the sandwich.
Create a class static demo with static member function for following function:
1)find factorial by recursive member function.
2)to check whether a number is prime or not
. Use (Switch case) command.
HINT: you have to set some drinks and set them some valid values that should not exceed
more then 1$ (Avoid Negative values)
Requirements:
Following are the requirements for the above discussed problem:
a. Vending Machine must keep track of the inventory
b. A person should be able to insert cash into the machine & choose an item
c. The Machine should confirm the inserted cash with the price of the selected item
d. The machine must display an error in case of insufficient cash or unavailable item
e. Finally, if all the above steps succeed then the user gets the selected item