Write statements to accomplish each of the following tasks:

a) Create a regular expression to match either a five-letter word or five-digit number.
b) Create a regular expression to match a phone number in the form of (123) 456-7890.
c) Create a shared_ptr to the int 5 called intPtr.
d) Create a weak_ptr to intPtr called weakIntPtr.
e) Access the int’s value using weakIntPtr.


a) ```
boost::regex( "\\w{5}|\\d{5}" );
```
b) ```
boost::regex( "\\(\\d{3}\\)\\s\\d{3}-\\d{4}" );
```
c) ```
boost::shared_ptr< int > intPtr( new int( 5 ) );
```
d) ```
boost::weak_ptr< int > weakIntPtr( intPtr );
```
e) ```
boost::shared_ptr< int > sharedIntPtr = weakIntPtr.lock();
*sharedIntPtr;
```

Computer Science & Information Technology

You might also like to view...

Explain why a software system that is used in a real-world environment must change or become progressively less useful.

What will be an ideal response?

Computer Science & Information Technology

An exit effect is a slide transition that moves a slide element off the screen

Indicate whether the statement is true or false

Computer Science & Information Technology

Which of the following describes how often a component fails on average?

A. MTBF B. HSM C. MTTR D. NAS

Computer Science & Information Technology

In 1858, George Boole's original book was republished as An Investigation of the Laws of Thought.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology