Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,501 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,372 people online right now. Registration is fast and FREE... Join Now!




comparing strings

 
Reply to this topicStart new topic

comparing strings, don't know were to start

pascal
22 Mar, 2007 - 06:33 PM
Post #1

New D.I.C Head
*

Joined: 8 Feb, 2007
Posts: 18


My Contributions
[help]

the program is about a gaming show called "cash mi win" well i already created the database structure which holds trn and other info but now i need to verify whether the caller is 18 and above, the program must use the TRN and cross-reference it to the one in the database. using c language.

this is the program thus far no errors:
CODE

#include <stdio.h>
#include <string.h>
#define SIZE 7;
typedef struct
{
    int age;
    int trn;
    char fName[15];
    char lName[20];
    char address[30];
}employee;

void database ( employee );

void main()
{
    char first[15],last[20], address [30],time;

    
    employee Jill;
    
    Jill.age = 24;
    Jill.trn = 678284402;
    strcpy(Jill.fName, "Jill");  
    strcpy(Jill.lName, "Smith");
    
    employee jack;
    
    jack.age = 16;
    jack.trn = 104002008;
    strcpy(jack.fName, "jack");    
    strcpy(jack.lName, "sony ");
    
    
    employee Simone;
                                  
    Simone.age = 17;
    Simone.trn = 553515522;
    strcpy(Simone.fName, "Simone");
    strcpy(Simone.lName, "Spencer");
    
    
    employee Melissa;
    
    Jill.age = 18;
    Jill.trn = 666616600;
    strcpy(Melissa.fName, "Melissa");      
    strcpy(Melissa.lName, "Cole");
    
    
    employee  Kleen;
    
    Kleen.age = 19;
    Kleen.trn = 100200300;
    strcpy(Kleen.fName, "Kleen");    
    strcpy(Kleen.lName, "Scott");
    
    
    employee Andre;
    
    Andre.age = 20;
    Andre.trn = 400420530;
    strcpy(Andre.fName, "Andre");  
    strcpy(Andre.lName, "Reid");
    
  
    employee Shynell;
    
    Shynell.age = 21;
    Shynell.trn = 677767433;
    strcpy(Shynell.fName, "Shynell");  
    strcpy(Shynell.lName, "witter");
    
    employee April;
    
    April.age = 22;
    April.trn = 190201301;
    strcpy(April.fName, "April");  
    strcpy(April.lName, "Palmer");
    
    employee Jall;
    
    Jill.age = 23;
    Jill.trn = 210220243;
    strcpy(Jall.fName, "Jall");
    strcpy(Jall.lName, "Smith");
    
    employee Stacia;
    
    Stacia.age = 24;
    Stacia.trn = 177967574;
    strcpy(Stacia.fName, "Staica");  
    strcpy(Stacia.lName, "Palmer");
    
    employee Ann;
    
    Ann.age = 24;
    Ann.trn = 191174634;          
    strcpy(Ann.fName, "Kadie-Ann");
    strcpy(Ann.lName, "Hall");
    
    employee Helen;
    
    Helen.age = 23;
    Helen.trn = 495333343;
    strcpy( Helen.fName, "Helen");    
    strcpy( Helen.lName, "Bingham");
    
    employee Joy;
    
    Joy.age = 19;
    Joy.trn = 909111212;
    strcpy(Joy.fName, "Joy");
    strcpy(Joy.lName, "Suwart");  
    
    employee kevin;
    
    kevin.age = 34;
    kevin.trn = 888878812;          
    strcpy(kevin.fName, "Kevin");
    strcpy(kevin.lName, "Mundell");
    
    employee Kristen;
    
    Kristen.age = 16;
    Kristen.trn = 712733576;
    strcpy(Kristen.fName, "Kristen");  
    strcpy(Kristen.lName, "Cole");
    
    employee Camille;
    
    Camille.age = 27;
    Camille.trn = 904764015;
    strcpy(Camille.fName, "Camille");
    strcpy(Camille.lName, "Taylor");
    
    employee Rachell;
    
    Rachell.age = 30;
    Rachell.trn = 445537611;
    strcpy(Rachell.fName, "Rachell");
    strcpy(Rachell.lName, "Mills");
    
    employee Steven;
    
    Steven.age = 31;
    Steven.trn = 882247542;
    strcpy(Steven.fName, "Steven");      
    strcpy(Steven.lName, "Richards");

    employee Richard;
    
    Richard.age = 42;
    Richard.trn = 198676134;        
    strcpy(Richard.fName, "Richard");
    strcpy(Richard.lName, "Coley");
    
    employee Jimmy;
    
    Jimmy.age = 16;
    Jimmy.trn = 212202112;        
    strcpy(Jimmy.fName, "Jimmy");
    strcpy(Jimmy.lName, "Brown");
    
    employee Tony;
    
    Tony.age = 17;
    Tony.trn = 133676234;
    strcpy(Tony.fName, "Tony");  
    strcpy(Tony.lName, "Mattaron");
    
    employee Andrew;    
    Andrew.age = 20;
    Andrew.trn = 141414555;
    strcpy(Andrew.fName, "Andrew");  
    strcpy(Andrew.lName, "Lawerance");
    

    employee Brody;
    
    Brody.age = 32;
    Brody.trn = 313131333;
    strcpy(Brody.fName, "Brody");
    strcpy(Brody.lName, "Smith");
    
    employee Fancy;
    
    Fancy.age = 34;
    Fancy.trn = 540039919;      
    strcpy(Fancy.fName, "Fancy");
    strcpy(Fancy.lName, "Crane");
    
    employee Britney;
    
    Britney.age = 55;
    Britney.trn = 424927674;      
    strcpy(Britney.fName, "Britney");
    strcpy(Britney.lName, "Spears");
    
    employee Shawn;
    
    Shawn.age = 49;
    Shawn.trn = 891617900;
    strcpy(Shawn.fName, "Shawn");  
    strcpy(Shawn.lName, "Combs");
    
    employee Beyonce;
    
    Beyonce.age = 24;
    Beyonce.trn = 282630507;
    strcpy(Beyonce.fName, "Beyonce");  
    strcpy(Beyonce.lName, "Knowles");
    
    employee Jessica;
    
    Jessica.age = 44;
    Jessica.trn = 368338388;
    strcpy(Jessica.fName, "Jessica");  
    strcpy(Jessica.lName, "Simspon");
    
    employee Jade;
    
    Jade.age = 22;
    Jade.trn = 446948134;
    strcpy(Jade.fName, "Jade");    
    strcpy(Jade.lName, "Thompson");
    

    employee Janell;
    
    Janell.age = 54;
    Janell.trn = 436139756;
    strcpy(Janell.fName, "Janell");  
    strcpy(Janell.lName, "Palmer");
    

    employee Jerod;
    
    Jerod.age = 19;
    Jerod.trn = 101987567;
    strcpy(Jerod.fName, "Jerod");
    strcpy(Jerod.lName, "Jerry");
    

    employee Sheldon;
    
    Sheldon.age = 18;
    Sheldon.trn = 889989898;
    strcpy(Sheldon.fName, "Sheldon");  
    strcpy(Sheldon.lName, "Price");
    
    employee Peter;
    
    Peter.age = 18;
    Peter.trn = 890336666;
    strcpy(Peter.fName, "Peter");  
    strcpy(Peter.lName, "Black");
    

    employee Donovan;
      
    Donovan.age = 64;
    Donovan.trn = 966690457;
    strcpy(Donovan.fName, "Danovan");
    strcpy(Donovan.lName, "Brown");
    
   employee Kent;
    
    Kent.age = 80;
    Kent.trn = 119118117;
    strcpy(Kent.fName, "Kent");  
    strcpy(Kent.lName, "White");
    
   employee Kevin;
    
    Kevin.age = 24;
    Kevin.trn = 221222224;
    strcpy(Kevin.fName, "Kevin");
    strcpy(Kevin.lName, "Rowe");
    
   employee Kamer;
    
    Kamer.age = 19;
    Kamer.trn = 409678423;
    strcpy(Kamer.fName, "Kamer");  
    strcpy(Kamer.lName, "Johnson");
    

   employee Tash;
    
    Tash.age = 18;
    Tash.trn = 727382446;
    strcpy(Tash.fName, "Tash");
    strcpy(Tash.lName, "Gyal");
    
    employee Cemille;
    
    Cemille.age = 24;
    Cemille.trn = 339567343;
    strcpy(Cemille.fName, "Cemille");    
    strcpy(Cemille.lName, "Willimas");
    
    employee Danion;
    
    Danion.age = 33;
    Danion.trn = 005505500;
    strcpy(Danion.fName, "Danion");      
    strcpy(Danion.lName, "Mitchell");
    
    employee Oneil;
    
    Oneil.age = 26;
    Oneil.trn = 678975680;
    strcpy(Oneil.fName, "Oneil");
    strcpy(Oneil.lName, "Turner");
    
    employee Paul;
    
    Paul.age = 25;
    Paul.trn = 444111222;
    strcpy(Paul.fName, "Paul");
    strcpy(Paul.lName, "Wright");
    


    employee Vanessa;
    
    Vanessa.age = 23;
    Vanessa.trn = 333414565;
    strcpy(Vanessa.fName, "Vanessa");
    strcpy(Vanessa.lName, "Holness");

    employee Lotoya;
    
    Lotoya.age = 22;
    Lotoya.trn = 656787989;
    strcpy(Lotoya.fName, "Lotoya");
    strcpy(Lotoya.lName, "Lewis");
    
    employee Keneisha;
    
    Keneisha.age = 21;
    Keneisha.trn = 101121456;
    strcpy(Keneisha.fName, "Keneisha");
    strcpy(Keneisha.lName, "Nelson");  
    
    employee Delona;
    
    Delona.age = 24;
    Delona.trn = 809908890;
    strcpy(Delona.fName, "Delona");  
    strcpy(Delona.lName, "Peterson");
    
    employee Tamekia;
    
    Tamekia.age = 51;
    Tamekia.trn = 765776666;
    strcpy(Tamekia.fName, "Tamekia");  
    strcpy(Tamekia.lName, "Austin");
    
    employee Nickesha;
    
    Nickesha.age = 53;
    Nickesha.trn = 986098877;
    strcpy(Nickesha.fName, "Nickesha");
    strcpy(Nickesha.lName, "Reid");
    

    employee Mandy;
    
    Mandy.age = 55;
    Mandy.trn = 346098345;
    strcpy(Mandy.fName, "Mandy");  
    strcpy(Mandy.lName, "Moore");
    
    employee Monique;
    
    Monique.age = 56;
    Monique.trn = 166849888;
    strcpy(Monique.fName, "Monique");
    strcpy(Monique.lName, "Robinson");
    
    printf("Enter there First Name \t");
    scanf("%s", &first );
    printf("\nEnter there Last Name \n");
    scanf("%s", &last );
    printf("\nEnter there Address \n");
    scanf("%s", &address );

    time= SIZE;
    
    }

HELP THIS IS DUE LIKE YESTERDAY PLEASE

This post has been edited by born2c0de: 23 Mar, 2007 - 10:07 PM
User is offlineProfile CardPM
+Quote Post

pascal
RE: Comparing Strings
22 Mar, 2007 - 07:54 PM
Post #2

New D.I.C Head
*

Joined: 8 Feb, 2007
Posts: 18


My Contributions
SOMEONE PLEASE HELP ME OUT I'M GOING OUT OF MY MIND
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Comparing Strings
22 Mar, 2007 - 07:55 PM
Post #3

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,303



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Please enclose your code using [code][ /code] tags when posting your code.

You say it compiles without errors, can you please describe the problem that you are having?
User is online!Profile CardPM
+Quote Post

pascal
RE: Comparing Strings
22 Mar, 2007 - 07:57 PM
Post #4

New D.I.C Head
*

Joined: 8 Feb, 2007
Posts: 18


My Contributions
I NEED HELP IN COMPARING THE TRN BY CROSS -REFRENCE SO TO VERIFY THAT THE CALLER IS 18 AND OVER THE DATABASE IS OK JUST NEED HELP WITH THE COMPARING TO VERIFY THE CALLER IS OVER 18 USING THE TRN.


YOUR HELP WOULD BE GREATLY APPRECIATED. THANK YOU

This post has been edited by pascal: 22 Mar, 2007 - 08:09 PM
User is offlineProfile CardPM
+Quote Post

pascal
RE: Comparing Strings
22 Mar, 2007 - 08:19 PM
Post #5

New D.I.C Head
*

Joined: 8 Feb, 2007
Posts: 18


My Contributions
ANYONE THERE I'VE TO GET READY FOR SCHOOL IN THE NEXT 5HRS
ANYONE REPLY MY POST IT'S URGENT
User is offlineProfile CardPM
+Quote Post

Trogdor
RE: Comparing Strings
23 Mar, 2007 - 06:49 AM
Post #6

D.I.C Addict
Group Icon

Joined: 6 Oct, 2006
Posts: 549



Thanked: 4 times
Dream Kudos: 125
My Contributions
1: Enclose your code in code tags to make it readable.
2: Caps only text is considered shouting and is not appreciated.
3: No, we will not do your homework.

..

186: Hint: define an array of employees to hold all those structs you define.
User is offlineProfile CardPM
+Quote Post

NickDMax
RE: Comparing Strings
23 Mar, 2007 - 11:05 AM
Post #7

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,867



Thanked: 53 times
Dream Kudos: 550
My Contributions
It really is a little unfair to expect people to help 11'th hour. I do however understand the frustration. Trogdor had a good point, if you had put the info into an array, you could simply search the array, since you did not, you would have had to use a BIG switch statement to find the employees... not a very economic solution as you would have to rewrite code to do all the different searches. (If I were your teacher I would not really have accepted such a solution for full credit).

next time please try to give us more time.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/7/09 06:37PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month