by Kenji » Fri May 07, 2004 2:48 pm
Here this is what I have for code
#include<iostream.h>
#include<fstream>
#include<vector>
using namespace std;
void write(void);
void read(void);
void numsorter(void);
vector<vector<int> > number;
int counter = 0;
int main()
{
int go = 0;
cout<<"(1) Write numbers to file\n";
cout<<"(2) Read numbers from file\n";
cin>>go;
if(go == 1)
{
write();
}
if(go == 2)
{
read();
}
return 0;
}
void numsorter(void)
{
sort(number);
}
void write(void)
{
cout<<"Enter a list of numbers, press 0 to terminiate\n";
do
{
counter++;
cin>>number[counter];
if(number[counter] == 0)
{
cout<<"Detected a zero!\n";
}
}
while(number[counter] != 0);
int counter1 = 0;
number[0];
int somevar = counter;
counter = 0;
while(counter1 <= somevar)
{
counter1++;
counter++;
ofstream outFile ("numbers.txt", ios::app);
outFile <<number[counter]<<"\n";
outFile.close();
}
main();
}
void read(void)
{
counter = 0;
ifstream inFile ("numbers.txt", ios::in);
if(!inFile)
{
cout<<"Whoa, what did you do to the numbers file? It ain't there!\n";
main();
}
cout<<"\n";
while(inFile >> number[counter])
{
cout<<number[counter]<<"\n";
counter++;
}
cout<<"\n";
inFile.close();
main();
}
And this is what i get for errors
error C2065: 'sort' : undeclared
error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class std::vector<int,class std::allocator<int> >' (or there is no acceptable conversion)
error C2676: binary '==' : 'class std::vector<int,class std::allocator<int> >' does not define this operator or a conversion to a type acceptable to the predefined operator
error C2676: binary '!=' : 'class std::vector<int,class std::allocator<int> >' does not define this operator or a conversion to a type acceptable to the predefined operator
error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::vector<int,class std::allocator<int> >' (or there is no acceptable conversion)
error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class std::vector<int,class std::allocator<int> >' (or there is no acceptable conversion)
fatal error C1903: unable to recover from previous error(s); stopping compilation
HELP!!!!!!
"The day you want to stop learning is the day you should die."