Having trouble with these c++ function prototypes, why do I keep getting errors
Having trouble with these c++ function prototypes, why do I keep getting errors
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Having trouble with these c++ function prototypes, why do I keep getting errors

Transcribed Image Text:Below is the transcription of the provided C++ header file code snippet, suitable for an educational website. It includes a description of the content and function prototypes.
---
```cpp
#ifndef PE04_H
#define PE04_H
#include <string>
// PLACE YOUR PROTOTYPES BELOW THIS LINE
// A.
int crypt(const bool& x, int& y);
// B.
string ord(string& ad);
// C.
void readLink(const double& a, const string& b, const bool& c);
// D.
bool dbClose(const string& s, const int& i);
// E.
string require(const string& a, bool& b);
// PUT YOUR PROTOTYPES ABOVE THIS LINE
#endif
```
### Description
This header file, `PE04_H`, defines several function prototypes intended for implementation elsewhere. Each function serves a specific purpose that should be elaborated upon within the implementation file (.cpp).
### Function Prototypes
- **A. `int crypt(const bool& x, int& y);`**
- **Parameters:**
- `x`: A constant boolean reference.
- `y`: An integer reference.
- **Return Type:** Integer.
- **B. `string ord(string& ad);`**
- **Parameters:**
- `ad`: A string passed by reference.
- **Return Type:** String.
- **C. `void readLink(const double& a, const string& b, const bool& c);`**
- **Parameters:**
- `a`: A constant double reference.
- `b`: A constant string reference.
- `c`: A constant boolean reference.
- **Return Type:** Void.
- **D. `bool dbClose(const string& s, const int& i);`**
- **Parameters:**
- `s`: A constant string reference.
- `i`: A constant integer reference.
- **Return Type:** Boolean.
- **E. `string require(const string& a, bool& b);`**
- **Parameters:**
- `a`: A constant string reference.
- `b`: A boolean reference.
- **Return Type:** String.
Each function prototype is included between the `#ifndef` / `#define` preprocessor directives, ensuring the header is only included once per compilation unit to prevent redefinition errors. The `#endif` marks the end of the conditional inclusion.
This header

Transcribed Image Text:Running PrototypeTester.cpp
Error:
```
pe04.h:11:1: error: ‘string’ does not name a type; did you mean ‘stdin’?
11 | string ord(string& ad);
| ^~~~~~
| stdin
pe04.h:14:38: error: ‘string’ does not name a type; did you mean ‘stdin’?
14 | void readLink(const double& a, const string& b, const bool& c);
| ^~~~~~
| stdin
pe04.h:17:20: error: ‘string’ does not name a type; did you mean ‘stdin’?
17 | bool dbClose(const string& s, const int& i);
| ^~~~~~
| stdin
pe04.h:20:1: error: ‘string’ does not name a type; did you mean ‘stdin’?
20 | string require(const string& a, bool& b);
| ^~~~~~
| stdin
```
**Explanation:**
The provided compilation error messages indicate that the C++ compiler cannot recognize 'string' as a valid type. This error often occurs when the necessary header file (`<string>`) is not included.
In each error message:
- The line number and position are specified.
- A suggestion is incorrectly made, offering 'stdin' as a replacement.
- The source file in question is `pe04.h`.
To fix these errors, ensure that the `<string>` header is included at the beginning of the source file or files where the `string` class is used. Usage should be prefixed with `std::` unless there is a `using namespace std;` directive.
Expert Solution

Step 1
There is one C++ program given and we have to solve the errors that this program is giving,
Step by step
Solved in 2 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education