Hi,
I want to know how to read multiple text files in this program...
I have 5 text files(order1,order2,...order5)
Can anyone pls help me with this?
I use DevC++.
#include<iostream.h>
#include<fstream.h>
#include<conio.h>
#include<windows.h>
using namespace std;
class{
public:
void menu()
{
ifstream menu;
menu.open("menu.txt");
string STRING;
string inFile_contents;
string previousLine="";
while(!menu.eof())
{
getline(menu,STRING); // Saves the line in STRING.
if (STRING != previousLine)
{
previousLine=STRING;
cout<<STRING<<endl; // Prints our STRING.
}
}
menu.close();
}
void view_order()
{
ifstream order;
order.open("order.txt");
string STRING;
string inFile_contents;
string previousLine="";
while(!order.eof())
{
getline(order,STRING);
if (STRING != previousLine)
{
previousLine=STRING;
cout<<STRING<<endl;
}
}
order.close();
}
}c;
int main()
{
c.menu();
c.view_order();
getch();
}