So hello guys, its my code:
#include <iostream>
#include <string>
using namespace std;
void writeDown(string*t)
{
for (int i = 0; *(t+i)!=NULL; i++)
{
cout << *(t+i) <<endl;
}
}
int main()
{
string t;
getline(cin, t);
string *wsk = &t;
writeDown(wsk);
return 0;
}
So I simply insert a string, and program should cout<< every single char from it in a new line. But here is what pops out:
binary '!=' : no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion)
What am I doing wrong?
Btw. I am working in VS 2013 for Win Desktop (btw. vol.2 - is it a good environment for C++ coding? - got 2015, but it's to slow on my laptop)
std::string*like it's achar*. That's not how it works, they are very different things.std::stringis analogous toconst char*, to what wouldstd::string*be analogous?