Why does the compiler complain if I attempt to use a vector as a base container for a stack of double values? The declaration is:

```
stack> myStack;
```

The VC++ compiler says
```
stack> myStack; //error: missing ','
//before identifier 'myStack'
```

The Borland compiler identifies the line where the error occurs but provides these (unhelpful)error messages:
```
10: Undefined symbol 'myStack' in function main()
10: Cannot generate template specialization from '
vector' in function main()
12: Improper use of typedef 'stack'
in function main()
12.: Statement missing ; in function main()
```

Each compiler is using the “maximum munch” algorithm for collecting input characters to make tokens. This means the compiler collects the most symbols possible that make a legal token in the C++ language. The closing > for int and the closing > for int, vector are together. Together, they make the >> (extraction and left arithmetic shift) operator, so the compiler sees them as the >> operator. This is an error the compiler thinks could be fixed with a comma. You should put space between the two > characters.

Computer Science & Information Technology

You might also like to view...

A user interface in Windows 10 that groups commands for performing related tasks on tabs across the upper portion of a window is the ________

Fill in the blank(s) with correct word

Computer Science & Information Technology

How many network bits are in each of the following classes?

a. Class A b. Class B a. 8 bits b. 16 bits

Computer Science & Information Technology