while(!infile.eof()) {
infile >> sal[sal_size].serial >> sal[sal_size].market >> sal[sal_size].date>> sal[sal_size].sn>> sal[sal_size].id>> sal[sal_size].num>> sal[sal_size].price;
sal_size++; }
///////////////ȡͳһÁ÷Ë®µÄÉÌÆ·IDÇ°Èýλ°´ÉýÐòÎÞÖظ´µÄ±£´æÆðÀ´/////////////////////////
new1[0][0]=sal[0].id/10000; for (int i =1;i new1[m][n]=sal[i].id/10000; //////Á÷Ë®ºÅÏàͬ n++; //outfile< if(new1[m][j] > new1[m][j+1]) { int t = new1[m][j]; new1[m][j] = new1[m][j+1]; new1[m][j+1] = t; } } } for(int l= 0;l< n;l++) { if(new1[m][l-1]!=new1[m][l]) outfile< } } infile.close();//¹Ø±ÕÎļþ outfile.close();//¹Ø±ÕÎļþ system( \} 2¡¢//AprioriËã·¨ÍÚ¾òƵ·±Ïsupport = 2£¨¼Ó×¢ÊÍ£© #include const int minsup=2; //ÉèÖÃ×îС֧³Ö¶È map vector int isExist(vector vector { ////////////////////////////////////////////¼ôÖ¦¹¤×÷//// int count=0; //ͳ¼ÆÁ½¸övectorÖÐÏàͬµÄÏîµÄÊýÄ¿ vector map tempMap[vect1[st]]++; vect.push_back(vect1[st]); } for(int st=0;st tempMap[vect2[st]]++; if(tempMap[vect2[st]]==2) //±íʾÕâÁ½ÏîÏàͬ { count++; } else { vect.push_back(vect2[st]); } } if((count+1)!=round) //ÒªÇóÁ½¸öÏîÄ¿¼¯Ö»ÓÐÒ»¸öÏîÄ¿²»Ïàͬ£¬ÆäËû¶¼Ïàͬ { vect.clear(); } return vect; } int isExist(vector { int count; //ͳ¼ÆÏàͬµÄÏîµÄÊýÄ¿ if(!items.empty()) { for(vector count=0; for(vector for(vector if(item[iz]==items[ix].at(iy)) { count++; } } } if(count==item.size()) //±íʾ´æÔÚ { return 1; } } } return 0; } int main() { vector vector long trancount=0; //ÔʼÊÂÎñ×ÜÊý char name1[50]; ifstream file; cout<<\Ñ¡ÔñÒª´ò¿ªµÄÎļþ£ºnew1.txt new2.txt new3.txt\ cin>>name1; file.open(name1,ios::in); //´ò¿ªÊý¾ÝÎļþ if(!file) //¼ì²éÎļþÊÇ·ñ´ò¿ª³É¹¦ { cout<<\ return 1; } else { string temp; vector while(getline(file,temp)) //Ò»ÐÐÒ»ÐжÁÈëÊý¾Ý { trancount++; begin=0; temp.erase(0,temp.find_first_not_of(\È¥³ý×Ö·û´®Êײ¿µÄ¿Õ¸ñ temp.erase(temp.find_last_not_of(\ while((end=temp.find('\\t',begin))!=string::npos) //ÿһ¸öÊÂÎñÖеÄÏîÊÇÒÔ'\\t'Ϊ·Ö¸ô·ûµÄ { item.push_back(temp.substr(begin,end-begin)); //½«Ã¿Ò»¸öÏî²åÈëitemÖÐ begin=end+1; } item.push_back(temp.substr(begin)); //Ò»¸öÊÂÎñÖеÄ×îºóÒ»Ïî datavec.push_back(item); //½«Ò»¸öÊÂÎñÖеÄËùÓÐÏîµ±³ÉÒ»¸öÕûÌå²åÈëÁíÒ»¸ö´óµÄvectorÖÐ item.clear(); //Çå¿Õitem } cout<<\ getchar(); map for(vector for(vector items_count[datavec[ix].at(iy)]++; //¸ÃÏµÄ¼ÆÊý¼Ó item_map[datavec[ix].at(iy)]=1; //±íʾ¸ÃÏîÄ¿ÔÚ¸ÃÊÂÎñÖдæÔÚ£¬ÖµÎª1£¬·ñÔòĬÈÏΪ0 } bitmap.push_back(item_map); item_map.clear(); //ÕâÀïÒ»¶¨ÒªÇå¿ÕÒ»ÏÂ