i am new to c++ and i have a really bad time with classes and objects. I can't find a way to make the user to enter the data and not just some cout <<".."; from me. I need to understand classes and objects . I would really appreciate your help. I searched the forum for a similar question and i didn't find something, if i missed it i am really sorry .
#include <iostream>
#include <string>
using namespace std;
class ManosClass{
public:
string name;
};
int main ()
{
ManosClass co;
co.name = //i want here the user to enter his name for example and i can't figure a way to do this
cout << co.name;
return 0;
}
To read user input, you are looking for see std::getline or use std::cin
std::getline(std::cin, co.name);
or
std::cin >> co.name;