Simple vector program error
Posted
by Codeguru
on Stack Overflow
See other posts from Stack Overflow
or by Codeguru
Published on 2010-03-29T04:30:37Z
Indexed on
2010/03/29
4:33 UTC
Read the original article
Hit count: 327
Hi iam new to c++ and iam trying out this vector program and i am getting the following error:
error: conversion from test*' to non-scalar type
test' requested|
Here is the code
include
include
include
include
using namespace std;
class test{
string s;
vector <string> v;
public:
void read(){
ifstream in ("c://test.txt");
while(getline(in,s))
{
v.push_back(s);
}
for(int i=0;i<v.size();i++)
{
cout<<v[i]<<"\n";
}
}
}; int main() { cout<<"Opening the file to read and displaying on the screen"<
}
© Stack Overflow or respective owner