1. In the main function below the local variable host is the one that
receives an integer value as a result of the cin statement. Modify
the cin statement to allow the global variable host to receive a float
value as a result of the cin statement.
#include <iostream.h>
float host;
void main ()
{
int host;
cin >> host;
}
2. Write 3 statements in the main function below: (1) Initialize the
pointer tag to point to a bookstore structure memory location. (2)
Set the cost field of that bookstore to 49.95. (3) Delete the memory
location to which tag points.
struct bookstore
{
int LibraryofCongressNumber;
char* title;
float cost;
};
void main ()
{
}
3. In the appropriate location below, create an array with
numVideotapes integer memory locations. The pointer (array name)
videotape will be initialized to point to the first element of the
array.
#include <iostream.h>
void main ()
{
cout << "How many videotapes are there?" << endl;
int numVideotapes;
cin >> numVideotapes;
for (int i = 0; i < numVideotapes; i++)
cin >> videotape[i];
delete[] videotape;
}