c++ cant fix the error

my friend created a program for our project and he sent me the codes. and i dont have any idea in how to fix the errors please help.

heres the program:


#include <iostream>
#include <string>
#include <fstream>
#include <vector>
using namespace std;

struct Supplies
{
string supplyName;
string supplyAmount;
};



void add ( Supplies & thisSupply );
bool find ( string & supplyName );

void printinventory ( void );



const int items = 4;
Supplies Book [ items ] ;
int arrayIndex;
int Inventory = 0;



int main ( )
{

arrayIndex = 0;
Supplies temp;
char choice;
string supplyName;
int i;

do
{
cout << endl << endl << endl;
cout << "Welcome to your lemonade stand!!" << endl;
cout << "What would you like to do?" << endl << endl;
cout << "1. Order supplies" << endl;
cout << "2. Check supplies" << endl;
cout << "3. Check ordered supplies" << endl;
cout << "4. Delete all ordered supplies" << endl;
cout << "5. Delete an ordered supply" << endl;
cout << "6. Quit" << endl << endl << endl;

cout << endl << "Enter number...." << endl;


cin >> choice;
while ( choice != '1' && choice != '2' && choice != '3' && choice != '4' && choice != '5' && choice != '6' )
{
cout << "Bad choice ( 1,2,3,4,5,6 ) , enter choice : ";
cin >> choice;
}

// Switch statement
switch ( choice )
{
case '1':
{
ofstream outfile("Orders.txt", ios::out | ios::app);

cout << endl;
cout << "Enter supply name: ";
cout << endl << "Lemons" << endl;
cout << "Ice" << endl;
cout << "Sugar" << endl;
cout << "Cups" << endl;
cin >> temp.supplyName;
outfile << temp.supplyName << " ";
cout << "Enter amount: ";
cin >> temp.supplyAmount;
outfile << temp.supplyAmount << endl;

outfile.close();

add ( temp );
}
break;

case '2':
{
cout << "Enter supply name: ";
cout << endl << "Lemons" << endl;
cout << "Ice" << endl;
cout << "Sugar" << endl;
cout << "Cups" << endl;
cin >> supplyName;

if ( find ( supplyName ) )
cout << supplyName << " is in the inventory." << endl;
else
cout << supplyName <<" is not in the inventory." << endl;
}
break;

case '3':
{
string line;
fstream outfile ("Orders.txt", ios::in | ios::out);
if (outfile.is_open())
{
while (! outfile.eof() )
{
getline (outfile,line);
cout << line << endl << " ";
}

outfile.close();
}
else
cout << "Unable to open file";
}
break;

case '4':
{
ofstream outfile("Orders.txt", ios::trunc);
outfile.close();
}
break;

case '5':
{
cin.sync();
vector<string> file;
string temp;

ifstream infile("Orders.txt");

while( !infile.eof() )
{
getline(infile, temp);
file.push_back(temp);
}
// done reading file
infile.close();

string item;

cout << "Enter an item to delete from the order: ";
getline(cin, item);

for(int i = 0; i < (int)file.size(); ++i)
{
if(file[i].substr(0, item.length()) == item)
{

file.erase(file.begin() + i);
cout << "Order erased!"<< endl;
i = 0; // Reset search
}
}

//write new order list back out
ofstream out("Orders.txt", ios::out | ios::trunc);

for(vector<string>::const_iterator i=file.begin(); i !=file.end();++i)
{
out <<*i<< endl;
}
out.close();
}
break;




}; // end of switch

}while (choice != '6');
return 0 ;
}



//FUNCTIONS.....

void add ( Supplies & thisSupply )
{
if ( arrayIndex >= items )
arrayIndex = 0;

if ( Inventory < items )
Inventory++;



Book [ arrayIndex ].supplyName = thisSupply.supplyName;
Book [ arrayIndex ].supplyAmount = thisSupply.supplyAmount;
arrayIndex++;

return;
}



//
bool find( string & supplyName )
{
int i = 0;

while ( i < Inventory )
{
if ( supplyName == Book [ i ].supplyName )
return true;

i++;
}

return false;
}



//
void printinventory ( void )
{
int i = 0;
while ( i < Inventory && i < items )
{
cout << i << ". " << Book [ i ].supplyName<< " " << Book [ i ].supplyAmount << endl;

i++;
}
return;
}
Use code tags.
What are the errors?
And why is your friend sending you code to correct if you have no experience in programming?
im just learning c++ we have been studying it for a month xD
and my friend sent it to me because he said that it may help me in the my project..

anyways the error is here:
for(vector<string>::const_iterator i=file.begin(); i !=file.end();++i)
{
cout<<i<<endl;
}

C:\Users\TUVIDA\Desktop\c++ proj\proj 1\inventory.cpp(162) : error C2040: 'i' : 'const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *' differs in levels of indirection from 'int'

C:\Users\TUVIDA\Desktop\c++ proj\proj 1\inventory.cpp(162) : error C2446: '!=' : no conversion from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast

C:\Users\TUVIDA\Desktop\c++ proj\proj 1\inventory.cpp(162) : error C2040: '!=' : 'int' differs in levels of indirection from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *'
Error executing cl.exe.

inventory.obj - 3 error(s), 0 warning(s)
well i tried removing the lines where the error was and the program ran..
though there are still some problems in the data storing and data deletion i think i can handle it from here :p
Topic archived. No new replies allowed.