CFanatic

Go Back   CFanatic > Programming > C++ Programming

Join CFanatic Forum Now

how to delete duplicate record... topic posted under C++ Programming which is a part of Programming category in CFanatic Forum
Reply
 
Thread Tools Display Modes
  #1  
Old 09-11-2006, 11:52 PM
Junior Member
 
Join Date: Sep 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
bh_hensem is on a distinguished road
| More
how to delete duplicate record...

Hello,

Could some body help me how could i delete any duplicate or same record of the input ?

This is my plan but i am not sure it si working with C++ or not :-
My program will be pass "number" values to this function and the function will be find out all the match number from the numbering list (mCUGParameter variables) and save it into array. Finally the function will be delete any duplicate record of the array and print it.

Example of numbering list:-
#Input or number=group,date1,date2
01200485=31595,20060307120553,
01200485=31595,20060307120553,
01940403=31595,20060307120553,
01940403=31595,20060307120553,
01940403=31595,20060307120553,20060607120553

Expected result:-
01200485=31595,20060307120553,
01940403=31595,20060307120553,
01940403=31595,20060307120553,20060607120553

Then, i do not know how could i delete any duplicate input here... could somebody help me ?

or is it ok with my steps or my ideas ?

Code:
bool getCUGParameter(const G_String& number, int *cugIndex,
int *createTS, int *terminateTS)
{
    int mycharstr[100];
    int mycharstr1[30];
    int mycharstr2[30];
    int mycharstr3[30];
    G_DynArray<Parameter> matchedstrlist;
    G_String matchedstr;
    G_String lookupvalue;
    int numofmatchedstr;
 
    memset(mycharstr, '\0', sizeof(mycharstr));
    memset(mycharstr1, '\0', sizeof(mycharstr1));
    memset(mycharstr2, '\0', sizeof(mycharstr2));
    memset(mycharstr3, '\0', sizeof(mycharstr3));
 
    // find all matches number from mCUGParameter
    matchedstrlist = mCUGParameter.findMultipleMatchesWithoutEIgnoreSpace(number);
    numofmatchedstr = matchedstrlist.size();
 
    if (numofmatchedstr > 0) {
        int m;
        for (m=0; m <= numofmatchedstr; m++) {
              lookupvalue=matchedstrlist[m].getValue();
              removeBlank(lookupvalue);
              sscanf(lookupvalue.cStr(), "%s", mycharstr);
 
              int i = 0;
              int j = 0;
              int k = 0;
 
              for (i=0; mycharstr[i] != '\0'; i++) {
                   if (mycharstr[i] == ',') {
                         j++;
                         k = 0;
                   } else {
                         if (j == 0) {
                              mycharstr1[k] = mycharstr[i];
                          } else if (j == 1) {
                              mycharstr2[k] = mycharstr[i];
                          } else if (j ==2) {
                              mycharstr3[k] = mycharstr[i];
                          } else {
                              // do nothing
                          }
                          k++;
                   }
                   cugIndex[m] = mycharstr1[k];
                   createTS[m] = mycharstr2[k];
                   terminateTS[m] = mycharstr3[k];
              }
        }
 
        for (m=0; m < numofmatchedstr; m++) {
             cout << "TEST: " << cugIndex[m] << " - " << createTS[m] << " - " << terminateTS[m] << endl;
        }
        return true;
    } else {
        return false;
    }
}
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying Sequential Record cherries C Programming 1 12-20-2007 04:55 AM

 

Advertisement

CFanatic Search
Custom Search

Advertisement

All times are GMT -5. The time now is 03:04 AM.



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO ©2010, Crawlability, Inc.
Cfanatic.com is a premier member of the IDG TechNetwork. For advertising opportunities contact here
Get Paid for Working on Projects Matching Your Expertise at Go4Expert's Jobs Board