help this beginner!!

This is a discussion on help this beginner!! within the C++ Programming forums, part of the General Programming Boards category; Hi, the Q is if there are multiples of a single name in the database ,that records should be displayed ...

  1. #1
    Unregistered
    Guest

    help this beginner!!

    Hi,


    the Q is if there are multiples of a single name in the database ,that records should be displayed and user should be asked to type in the ID.....for which particular name he wants to make changes.......

    I was able to find duplicate names but I just cant understand how to display that specific duplicate records......

    If I run this code .......it just displays 0 0 0 0
    Multiple entries found.......
    please enter ID

    Please look at my code,and pls let me know where I am going wrong......
    I would really appreciate if someone help this beginner.

    [code]
    int position =-1;

    validCompName = validateCompetitorName(compName);
    result = checkDup(database,validCompName);

    if(result==1)
    {
    for(int i=0; i<tmprec;i++)
    {
    if(database[i].competitorName ==validCompName)
    {

    position = i;
    i= DATABASESIZE;

    if(position!=-1)
    {
    cout<<database[i].competitorName<<" "
    <<database[i].ID<<" "<< database[i].birthDate.day<<" "<<
    database[i].birthDate.month<<" "<<
    database[i].birthDate.year<<endl;


    cout<<Multiple entries found"<<endl;
    cout<<"pls type ID"<<endl;
    sID = getID();
    validID = validateID(sID,tmprec);
    ID = atoi(validID.c_str());
    if(database[i].ID!= ID)
    {
    cout<<"ID not found"<<endl;
    displayMainMenu();
    option =getMenuOption();
    activateMenu( option , tmprec , tempID, latID);
    }


    }//if position

    }//if
    }//for
    }//if result


    int checkDup ( competitor database[], string name )
    {
    int count = 0;


    for(int x= 0; x<DATABASESIZE;x++)
    {
    if ( database[x].competitorName == name )

    count++;

    }
    return ( count > 1 ) ? 1 : 0;


    }

  2. #2
    Unregistered
    Guest

    Unhappy Sorry

    Hi,
    Sorry forgot the codetag!


    the Q is if there are multiples of a single name in the database ,that records should be displayed and user should be asked to type in the ID.....for which particular name he wants to make changes.......

    I was able to find duplicate names but I just cant understand how to display that specific duplicate records......

    If I run this code .......it just displays 0 0 0 0
    Multiple entries found.......
    please enter ID

    Please look at my code,and pls let me know where I am going wrong......
    I would really appreciate if someone help this beginner.

    Code:
     
    int position =-1; 
    
    validCompName = validateCompetitorName(compName); 
    result = checkDup(database,validCompName); 
    
    if(result==1) 
    { 
    for(int i=0; i<tmprec;i++) 
    { 
    if(database[i].competitorName ==validCompName) 
    { 
    
    position = i; 
    i= DATABASESIZE; 
    
    if(position!=-1) 
    { 
    cout<<database[i].competitorName<<" " 
    <<database[i].ID<<" "<< database[i].birthDate.day<<" "<< 
    database[i].birthDate.month<<" "<< 
    database[i].birthDate.year<<endl; 
    
    
    cout<<Multiple entries found"<<endl; 
    cout<<"pls type ID"<<endl; 
    sID = getID(); 
    validID = validateID(sID,tmprec); 
    ID = atoi(validID.c_str()); 
    if(database[i].ID!= ID) 
    { 
    cout<<"ID not found"<<endl; 
    displayMainMenu(); 
    option =getMenuOption(); 
    activateMenu( option , tmprec , tempID, latID); 
    } 
    
    
    }//if position 
    
    }//if 
    }//for 
    }//if result 
    
    
    int checkDup ( competitor database[], string name ) 
    { 
    int count = 0; 
    
    
    for(int x= 0; x<DATABASESIZE;x++) 
    { 
    if ( database[x].competitorName == name ) 
    
    count++; 
    
    } 
    return ( count > 1 ) ? 1 : 0; 
    
    
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Please Help Me with this beginner C++ Program!
    By ClearSights in forum C++ Programming
    Replies: 7
    Last Post: 09-24-2008, 11:22 AM
  2. Same old beginner question...
    By Sharmz in forum C Programming
    Replies: 15
    Last Post: 08-04-2008, 12:48 PM
  3. What are some good beginner programs I shouold make?
    By oobootsy1 in forum C# Programming
    Replies: 6
    Last Post: 08-09-2005, 03:02 PM
  4. Windows programming for beginner (Absolute beginner)
    By WDT in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2004, 11:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21