What does the following program print and why? Be sure to explain why each line of output prints the way it does
#include <iostream>
using namespace std;
int* maxwell(int* a, int* b)
{
if (*a > *b)
return a;
else
return b;
}
void swap1(int* a, int* b)
{
int* temp = a;
a = b;
b = temp;
}
void swap2(int* a, int* b)
{
int temp = *a;
*a = *b;
*b = temp;
}
int main()
{
int array[6] = { 5, 3, 4, 17, 22, 19 };
int* ptr = maxwell(array, &array[2]);
*ptr = -1;
ptr += 2;
ptr[1] = 9;
*(array+1) = 79;
cout << &array[5] - ptr << endl;
swap1(&array[0], &array[1]);
swap2(array, &array[2]);
for (int i = 0; i < 6; i++)
cout << array[i] << endl;
} Write a class which consists of four data members and four member function sum min max and factorial you can inilized class object or can be take by an function
You have been cordially invited to partake in Operation: Operation. Your mission, should you choose to accept it, is to take the two numbers and the operator given then perform the operation successfully.
Instructions:
Input
A line containing a number, operator, and another number separated by a space.
5·+·0.70Output
A line containing a decimal/float containing two decimal places.
5.70Input three decimal numbers in one line separated by spaces, and make sure to store them in different variables.
Multiply the 1st and 2nd decimal numbers, and store the product into a variable.
Then, divide the product of the 1st and 2nd decimal numbers with the 3rd decimal number, then print out its quotient, with 2 decimal places.
Your task is to write array implementation of a list with the following functions
Insert
Delete
Search
Sort
Note:No global declarations
Create a class called STRING, the class has two private member str and size of String and int type respectively. Provide a copy constructor for the class that initialize objects with other object. Write member function for the class that show the string and size for each object.
The following are the assumed existing equivalent currency rates corresponding to the US dollar ($1.00); Australia (Aus $), 1.09; Hong Kong (HK $), 7.81; Indonesia (Rupiah), 990.41; Japan (Yen), 234.93; Malaysia (Ringgit), 2.34; Philippines (Peso), 13.80. Prepare a program that will accept US dollar and currency to be converted as inputs, then compute the equivalent in the chosen foreign currency. Print the results.
(Use switch statement.)
write program link list insert midle and delete ?
Make following patterns using loops. Do not hard code anything.
i)
|......|....................|
|......|.......***....*.....|
|......|......**....*.*.*...|
|......|.....**.....*...*...|
|......|......**............|
|......|........***.........|
|......|....................|
ii)
1
232
34543
4567654
567898765
4567654
34543
232
1
2 1234567654321
12345654321
123454321
1234321
12321
121
1
iii)
1 *
**
****
***********
*** ***
** **
* *
2
-.*
-.*-.*
-.*-.*-.*
-.*-.*-.*-.*
-.*-.*-.*-.*-.*