By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,197 Members | 1,151 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,197 IT Pros & Developers. It's quick & easy.

vectors in C++

P: 8
HI
this is my code. please help me understand the allocator part.
i m pasting my code as well as the errors that i get.

#include<vector.h>
#include<algorithm.h>
#include<iostream.h>

class eval
{
vector<int> nodeno;
//vector<float> tfidf1;
//vector<float> tfidf2;
int count;

public :
void read()
{
std::ifstream data;
int i=0;
count = 0;
data.open("tfidf_input.txt");
if(data.fail())
cout<<"error opening file";
while(!(data.eof()))
{
data >> nodeno[i];
// data >> tfidf1[i];
// data >> tfidf2[i];
i++;
}
count = i;
data.close();

}
void display()
{
int j;
for(j=0;j<count;j++)
{
cout<<nodeno[j]<<" ";
//<<tfidf1[j]<<" ";
//cout<<tfidf2[j];
cout<<endl;
}
}
};

void main()
{
class eval object;
object.read();
object.display();
}

errors are :
error C2143: syntax error : missing ';' before '<'
error C2501: 'vector' : missing storage-class or type specifiers
error C2059: syntax error : '<'
error C2238: unexpected token(s) preceding ';'
Aug 13 '07 #1
Share this Question
Share on Google+
1 Reply


Meetee
Expert Mod 100+
P: 931

void main()
{
class eval object;
object.read();
object.display();
}

errors are :
error C2501: 'vector' : missing storage-class or type specifiers
In main(), in place of
class eval object;
use
eval object;

Regards
Aug 13 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.