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;
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;
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.
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