Use a map to create a table of foods and calories per portion. For example carrots-45, ice cream-250, and so on. Place at least 10 foods in your map. Use a random number generator to pick 4 foods per meal. Print out the meal and its calorie
Write a comparison object that uses the square of an objects value for comparison. Therefore, a large negative number is greater than a small positive number using this comparison object. Generate in a vector the integers -100 to +100 and use an
Read a text file and write it to a target text file, changing all lowercase to uppercase and double-spacing the output text. 讀取一個文字檔並將其寫入目標檔案,目標檔案中將所有的小寫字母轉換成大寫字母,並以雙倍行距輸出文本。 name.txtfanzhaoxinBUSH WillSadamuMicro
time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n boys and m girls attending a theatre club. To set a play "The Big Bang Theory", they need to choose a group containing exactly t actors
Create a parametric string type. The basic type is to act as container class that contains a class T object. In the prototype case, the object is a char. The normal end-of-string sentinel is 0. The standard behavior should model the functions found
Add some functions to the simple graphics system: perimeter(), area() and volume() to calculate its perimeter, area and volume (only for ThreeDimentionalShape) respectively; a function draw() to draw a shape with different colors, thickness and
Define a base class Person that contains universal information, including name, address, birth day, and gender. Derived from this class the following classes: class student: virtual public person { //……relevant additional state and
The following class is the my_string class that has reference semantics for copying. This class has shallow copy semantics because pointer assignment replaces copying. The techniques illustrated are common for this type of aggregate. We use the
time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputManao has invented a new mathematical term — a beautiful set of points. He calls a set of points on a plane beautiful if it meets the following
Implement and test an Intset class. Each object of this class will represent a set of integers, storing the different elements as integers. Provide constructors and some operations, such as Empty(), IsEmpty(),, IsMemberOf(int), IsEqual(IntSet&),
Implement and test a class deque, which is a double-ended queue that allows pushing and popping at both ends.class queue{public:void reset() { top = bottom = max_len/2; top--; }...private:char s[max_len];int bottom,top;};Declare and implement