Please help with simple program
Hi, I am making a program that prints actual mood that the user sets. But I can't find on the internet the right solution of fixing an error: "no matching function for call to 'Mood::setMood(std::__cxx11::string&)'".
main.cpp
Code:
#include<iostream>
#include<Mood.h>
#include<string>
std::string input;
std::string*pInput =&input;
int main()
{
Mood mood1;
std::string input;
std::string*pInput =&input;
std::cout <<"Enter mood: ";
std::cin >>*pInput;
mood1.setMood(*pInput);
std::cout << mood1.getMood()<< std::endl;
return 0;
}
Mood.h
Code:
#ifndef MOOD_H
#define MOOD_H
#include<string>
class Mood
{
public:
Mood(std::string*pInput);
void setMood(std::string x);
std::string getMood();
protected:
private:
std::string mood;
};
#endif// MOOD_H
Mood.cpp
Code:
#include"Mood.h"
#include<iostream>
#include<string>
Mood:: Mood(std::string*pInput)
{
std::string x;
}
void Mood::setMood(std::string x)
{
mood = x;
}
std::string Mood::getMood()
{
return mood;
}
EDIT:
I have edited your code to remove extra markup. Next time, just post your code as plain text within the code tags. The forum software will add readable markup and line numbering for you. ~laserlight