#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

struct staffTWB {
   string staffName;
   int staffProf;
};

void printEntry(staffTWB);

int main() {

string staffName;
int staffProf;

while (staffName != "done") {

    cout << "Please enter a staff name(done to leave the program):" << endl;
    getline(cin, staffName, '\n');
    if (staffName == "done") {
        break;
    }
    else {
        cout << "Please enter the profession of " << staffName << "\n";
        cin >> staffProf;
        cin.ignore();
        if (staffProf >= 1 && staffProf <= 4) {
            **printEntry(staffTWB);**
        }
        else {
            cout << "Wrong entry!\n";
            cin.clear();
            cin.sync();


        }

    }
}

The line with the astrix is where the error is occurring from

Recommended Answers

All 2 Replies

You're missing a closing curly bracket at the bottom of the document. You opened int main() but never closed it.

staffTWB is a structure and not an instance of the object.

rproffitt is referring to printEntry(staffTWB); where you are passing staffTWB into the printEntry() function, which you aren't allowed to do. You need to create an instance of staffTWB and pass that instance that you created into the function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.