hi guys
i think i have found the solution for the thead i posted a week ago. now i'm actually reading the file as a .txt file. here's the code:
Code:
[tag]
#include <iostream>
#include <conio>
#include "tokenizer.h"
void menu();
void option();
int main()
{
char ctr;
do
{
clrscr();
menu();
do
{
cout<<"\n\n\t Proceed with the next test case? (Y/N): \n";
cin>>ctr;
}while(ctr!='y' && ctr!='Y' && ctr!='n' && ctr!='N');
}while(ctr=='y' || ctr=='Y');
return 1;
}//end main
void menu()
{
cout<<"\n\n\n";
cout<<"\n\t\t * * * * * * * * * * * * * * * * * * * * * * * * * * \n\n";
cout<<"\n\t\t\t TESCAGEN: BB vs WB\n";
cout<<"\n\n\t\t\t Press S to Start the Program\n\n";
cout<<"\n\n\t\t Press Q to Quit the Program\n";
cout<<"\n\t\t * * * * * * * * * * * * * * * * * * * * * * * * * * \n";
option();
}
void option()
{
char menu;
ifstream infile;
cout<<"\n\n\t\t\t\t Please enter your choice: ";
cin>>menu;
if(isalpha(menu))
switch(menu)
{
case 'S':
case 's':
infile.open("ass.txt");
string line;
vector <string> tokens;
bool endOfFile = infile.eof();
int count =0;
while(!endOfFile)
{
endOfFile = getStringAndTokens(infile, line, tokens);
if(!endOfFile)
{
count++;
cout<<count<<")"<<line<<endl<<endl;
for(int i=0;i<tokens.size();i++)
{
cout<<tokens[i]<<endl;
}
cout<<"\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n"<<endl;
ifstream(infile);
system("Pause");
}//end if
}//end while
break;
}//end switch
else
cout<<"\t\t Wrong key in. Please try again.\n\n";
}
[/tag]
i kinda save the identifiers in another text file. let's say for identifier /*1*/, i save it in if.txt
if(i==1||i==x)
my question is, how would i compare those two files (ass.txt and if.txt) and then stated that if that identifier is found, in my case a test case will be generated for that identifier? is it possible to compare two files?