C++ Answers

Questions answered by Experts: 9 913

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Write a program to multiply two complex number and stored in third one by the concept of operator overloading using member function.


use appropriate pointer operator to print the addresses of the numbers in memory, the memory address must be expressed in hexadecimal
After the addresses of the numbers ,use the deferencing operator to point to values contained within addresses. Use the function sort with begin() and end() function to organize the values in ascending order.After establishment the order of values ,assign values into an array called winning-numbers. You can use the statement or the initializer list to initialize
The amounts won must be determined by custom made function called amountDeterminant of type double and receives a double argument in prototype, the argument will be the winning number received from the sum of two (2)
Amount Determination must use switch conditions and operate as follows :
If the winning number is ,
1. Between 80 and 83 , the won amount is R1700000-00
2. Between 84 and 86, the won amount is R2 50000-00
3. Between 87 and 98, the won amount is R16000000-00

Write a program called National_lottery. it should use rand function to produce 6 random numbers to 0 & 49, number must not repeat. use an appropriate pointer to print address of numbers in memory and its must be in hexadecimal. use derefencing operator to point in address. use function sort with begin() & end() function to organise values in ascending order, use a for statement to intialise numbers into arrays. Search any 2 array element that give sum of >=80 when added together, if numbers >=80 are more than one set, consider the biggest set chosen for draw. if the value of sum of the two are >=80, print "You W" & if they are < 80, print "You L". Amount won by custom made function amountDeterminat of type & double argument in prototype. argument will be winning number received from sum of 2 numbers. amountDeterminant must use switch conditions. if winning numbers is (80-83 won amount 1700000, 84-86 R2500000, 87-98 R16000000). add this #include<vector>.


Create a class called bMoney. It should store money amounts as long doubles. Use the
function mstold() to convert a money string entered as input into a long double, and
the function ldtoms() to convert the long double to a money string for display. (See
Exercises 6 and 10.) You can call the input and output member functions getmoney()
and putmoney(). Write another member function that adds two bMoney amounts; you can
call it madd(). Adding bMoney objects is easy: Just add the long double member data
amounts in two bMoney objects. Write a main() program that repeatedly asks the user to
enter two money strings, and then displays the sum as a money string. Here’s how the
class specifier might look:
class bMoney
{
private:
long double money;
public:
bMoney();
bMoney(char s[]);
void madd(bMoney m1, bMoney m2);
void getmoney();
void putmoney();
};
Start with a program that allows the user to input a number of integers, and then stores
them in an int array. Write a function called maxint() that goes through the array,
element by element, looking for the largest one. The function should take as arguments
the address of the array and the number of elements in it, and return the index number of
the largest element. The program should call this function and then display the largest
element and its index number.
Write a program that calculates the average of up to 100 English distances input by the
user. Create an array of objects of the Distance class, as in the ENGLARAY example . To calculate the average, you can borrow the add_dist() member function
from the ENGLCON example . You’ll also need a member function that divides
a Distance value by an integer. Here’s one possibility:
void Distance::div_dist(Distance d2, int divisor)
{
float fltfeet = d2.feet + d2.inches/12.0;
fltfeet /= divisor;
feet = int(fltfeet);
inches = (fltfeet-feet) * 12.0;
}
Create a class called employee that contains a name (an object of class string) and an
employee number (type long). Include a member function called getdata() to get data
from the user for insertion into the object, and another function called putdata() to
display the data. Assume the name has no embedded blanks.
Write a main() program to exercise this class. It should create an array of type employee,
and then invite the user to input data for up to 100 employees. Finally, it should print out
the data for all the employees.
Write a function called reversit() that reverses a C-string (an array of char). Use a for
loop that swaps the first and last characters, then the second and next-to-last characters,
and so on. The string should be passed to reversit() as an argument.
Write a program to exercise reversit(). The program should get a string from the user,
call reversit(), and print out the result. Use an input method that allows embedded
blanks. Test the program with Napoleon’s famous phrase, “Able was I ere I saw Elba.”

define a class length with feet (int type )and (float type) data members.define do-nothing constructor


Create a C++ Program that will identify the Discount Rate of a shopper based on issued loyalty card, take the following conditions:

Loyalty Card TypeDiscount (%)(1) Frequent Buyer10%(2) One Time Buyer0%(3) Senior Citizen15%

This should be the outcome if ever we run the program

Example:

Total Purchase Cost: Php 3000.00

Loyalty Card Type: 1

Discounted Cost: Php 2700.00

LATEST TUTORIALS
APPROVED BY CLIENTS