its says that lastfile is undeclared

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

//void displayData(ofstream &, item_info[], int, int &);

struct item_format 
  {
      string ID;
      string item_name;
      int current_stock;
      int ordered_stock;
      float retail_price;
      float selling_price;
  }item_info[30], greeting_cards, note_cards, calendars, pens, candles, wind_chimes;
void enterData(ifstream &, item_info[], int, int &);



int main () {

    int i;
    string line;
    string data[6];
    int datacounter = 0;
    string substr = "";


    ifstream lastfile;
    lastfile.open("lastweek.txt"); 

    ifstream myfile;
    myfile.open ("transaction.txt");

    ofstream thisfile;
    thisfile.open ("thisweek.txt");


    for(int index = 0; index < 5; index++) {

                            lastfile >> item_info[index].current_stock;
                            lastFile >> item_info[index].ID;
                            lastFile >> item_info[index].item_name;
                            lastFile >> item_info[index].ordered_stock;
                            lastFile >> item_info[index].retail_price;
                            lastfile >> item_info[index].selling_price;
                        }
                        cout << item_info[0].ID;

"lastfile" and "lastFile" are two different identifiers

commented: life saver!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.