C++: Unable to resolve identifier string?

Ho bisogno del vostro aiuto, sto programmando in C++ su Netbeans ma il compilatore mi da alcuni problemi con degli standard, in particolare con string ed endl.

Come da titolo Netbeans mi da i seguenti messaggi di errore: "Unable to resolve identifier string" e "Unable to resolve identifier endl".

Mi sapete dire come devo fare per risolvere questo problema?

Actualización:

#include <iostream>

using std::cout;

using std::endl;

#include <string>

using std::string;

class GradeBook {

public:

GradeBook(string name) {

setCourseName(name);

}

void setCourseName(string name) {

courseName = name;

}

string getCourseName() {

return courseName;

}

void displayMessage() {

cout << "Welcome to the grade book for\n" << getCourseName() << " !" << endl;

}

private:

string courseName;

};

int main() {

GradeBook gradebook1("CS101 Introduction to C++ programming");

GradeBook gradebook2("CS102 Data Structures in C++");

cout << "gradebook1 created for course: " << gradebook1.setCourseName()

<< "\ngradebook2 created for course: " << gradebook2.setCourseName()

<< endl;

return 0;

}

Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Helpful Social

Copyright © 2024 Q2A.ES - All rights reserved.