Create two objects p and q and generate 10 random numbers

Assignment Help Programming Languages
Reference no: EM13779925

1. Use the following class declarations template < class T, int n>

class TWO

{private: T aln];

public: void ReadData(); // read data into array a

void DisplayData(); //display array a

void SortArray(); //sort array a

-TWO() { }

};

a. Create Two objects P and Q. in object P the array a is type int and size 10, in Q array a is string type and size 12

b. Generate 10 random numbers <20 and store them in array a of object P. Store the name of the month from Dec to Jan in array a of object Q

c. Display the unsorted array a of P and Q

d. Make the SortArray to use the sort member of <algorithm> library to sort the array a of
each object

e. Display the sorted array a of objects P and Q

2. Use the "STACKLlB.h" library to do the following

a. Read a sentence and display it in reverse order

b. Read an integer number <100 and convert it to a new base 2, 8, or 16 Sample I/O

Enter a sentence: Happy Thanksgiving Sentence in reverse order is gnivigsknahTyppaH

Enter an integer number <100: 58

Enter a new base(2,8,16): 2

58 at base 2 is 111010

Try base 8 and 16. Paste all out puts at the end of your program

NOTE 50 at base 8 is 72, and at base 16 is 3A

3. Given two points A(x1, y1) and B(x2,y2), then

A(xl,y1) + B(x2,y2) = (x1+x2, y1+y2)
A(x1,y1) - B(x2,y2) = (x1-x2, y1-y2) K*A(x1,y1) = (k*x1,k* y1)

Write a program to overload the + , -, * operators to add , subtract two points , and multiply a point by constant k. At the end find the distance between the two points.

Sample I/O
Enter the coordinates of point A: 3 4
Enter the coordinates of point B: 5 7
A(2,3) + B(5,7) = C(7, 10)
A(2,3) - B(5,7) = C(-3, -4)
Enter a constant: 4
4*A(2,3)= C(8,12)
The distance from A(2,3) to B(5,7) is xx.xx

Reference no: EM13779925

Questions Cloud

Create a one-page flyer that contains advertise : Create a one-page flyer that contains advertise. A text description about the activities based on the fitness activities detailed above.
Recent ethical obligations confronting public administrators : In 3-4 pages, discuss public interest, administrative responsibility and some of the recent ethical obligations confronting public administrators in their day to day decision making.
How does the theory address the problem of crime : How does the theory address the problem of crime? How are cultural influences on crime integrated into the theory? What solutions for the individual, family, community, and society does the theory suggest
Just-in-time materials management : Discuss your thoughts about just-in-time materials management, its value, shortcomings, and provide an example of where it may be implemented. Below is a brief discussion of JIT vs. MRP. Two approaches have had a major impact on inventory management:..
Create two objects p and q and generate 10 random numbers : Create Two objects P and Q. in object P the array a is type int and size 10, in Q array a is string type and size 12b. Generate 10 random numbers
Transmitted illnesses and the social justice framework : Consider general access to care, maintenance of health and prevention of illness, and treatment of illness. Briefly compare differences in scope (the extent and relevance to the issue of social justice) of two the conditions, obesity and HIV/AIDS...
Impact of legislation on organizations : Your research paper should be no more than three (3) full pages, double spaced, 1-inch margins, in New Times Roman 12-pitch font, with a cover page (name, course number, date, title of paper) and a reference page.
Determine the activities of the intelligence community : There are steps that should be taken that can produce results with minimum errors. These steps, known as the intelligence cycle, include planning, collection, processing, analysis, and dissemination. The intelligence cycle is used to determine t..
Neurological disorders that can occur in development : Write 500 word essay on 2 different neurological disorders that can occur in development and how it affects development, In addition, discuss what research suggests about the effects of spiritual disciplines (prayer, meditation) on neurobiology A..

Reviews

Write a Review

Programming Languages Questions & Answers

  Do we require to format our program output does formatting

do we need to format our program output? does formatting only apply to numeric values? what about percent values and

  Develop console application to generate random number

Develop C++ console application which generates the random number which should be guessed by user. Program will indicate to user if their guess is correct, too high or too low.

  Write program that uses recursive function to count number

Write a program that uses a recursive function to count the number of blobs in a square grid. Input to the program should consist of the locations of the asterisk in the grid.

  Program to calculate monthly gross pay for super supermarket

Owners of Super Supermarket would like to have program which calculates monthly gross pay of their employees. Input for this program is employee ID number, hourly rate of pay.

  Write a program to enter series of numbers

Write a program that ask the user to enter a series of numbers ending with -1. After the -1 is input, program should print how many numbers are even and how many numbers are odd.

  Basics of hypertext markup language

The basics of Hypertext Markup Language and World Wide Web.

  Draw application to display button and label on a screen

Draw and implement application which displays a button and a label on a screen. Every time button is pushed, the label will display random number between 1 and 1000,

  Create ajax-based product catalog

Create an AJAX-based product catalog which obtains its data from JSON files located on the server. The data should be separated into four JSON files.

  Program to display words in a list box sorted by number

Write a program to display the words in a list box sorted by the number of different vowels(a,e,i,o,u) in the word.

  Program to return the array index having largest savings

Write down function also called from main module - this function will find out and return array index containing the largest savings.

  Program to determines and print all prime numbers

Use this function in program which determines and prints all prime numbers between 2 and 10,000. How many of these numbers do you actually have to test before being sure that you have found all primes?

  Expression whose value is distance between two point

a structured type with two fields, x and y, both of type double-- write an expression whose value is the distance between the two point represented by p1 and p2.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd