I'm working on learning C++, and still keep running into stupid problems as I am yet unfamiliar with C++ libraries, and common errors, etc.
right now, the following piece of my code fails:
#include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>
void getInt(int & val){
string output;
getline(cin output.c_str());
val = atoi(output.c_str());
}
and gives me this error when I try to compile it:
test.cpp: In function void getInt(int&):
test.cpp:51: error: expected ) before output
test.cpp:51: error: no matching function for call to getline(std::istream&)
What am I doing wrong? I feel like I'm missing something obvious.