pls. help in my program

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2008
Posts: 1
Reputation: nrew is an unknown quantity at this point 
Solved Threads: 0
nrew nrew is offline Offline
Newbie Poster

pls. help in my program

 
0
  #1
Oct 3rd, 2008
can somebody help me?Im a 1st yr. college student taking up IT. And we have this case study that I cant seem to answer on my own so I decided to join daniweb. The program that Im referring to is a slum book simulating program.
Where you need to enter first a certain username and password before you can enter the whole of the program.
And you also need to integrate a menu that serves as the selection of the user on what task he wants to do. The menu must contain: ADD-To add data into the slumbook, DELETE-To delete the data that you have inputted. EDIT-To edit the data that has been inputted, SEARCH-To search a certain data entered into the program. LIST-the program will list all the data you have inputted. and EXIT to exit the program.
Here is the sample program that I have made, but still it has many errors when you try to run the program:
  1. #include<iostream.h>
  2. #include<conio.h>
  3. #include<stdio.h>
  4. #include<string.h>
  5. void main(){
  6. clrscr();
  7. char name[15][20],neym[15][20],ad[15][30],adr[15][20];
  8. char hobiz[15][15],hobez[15][20],dis[15][30],ayaw[15][20];
  9. char aget[15][4],age[15][4],usrnem[4],pasw[4];
  10. char wern,nrew;
  11. int choiz;index://index-keeps track of insertion;
  12. int index=0;
  13. do{
  14. do{
  15. cout<<"This is a slumbook simulating program";
  16. cout<<"\nInput username to enter the program:";
  17. cout<<"\nUsername:";cin>>usrnem;
  18. cout<<"\nInput password:";cin>>pasw;
  19. strcpy(usrnem, "wern");
  20. strcpy(pasw,"nrew");
  21. strcmp(usrnem,usrnem);
  22. strcmp(pasw,pasw);{
  23.  
  24. }while(pasw=="nrew");
  25. cout<<"\nWelcome";
  26. cout<<"\nMenu:";
  27. cout<<"\n1.ADD DATA:";
  28. cout<<"\n2.EDit DATA:";
  29. cout<<"\n3.DELETE DATA:";
  30. cout<<"\n4.LIST DATA:";
  31. cout<<"\n5.SEARCH DATA:";
  32. cout<<"\nEXIT THE PROGRAM:";
  33. cout<<"\ninput your choice:";cin>>choiz;
  34. if(choiz==1){cout<<"\nThis Function lets you add data into the slumbook:";
  35.  
  36. cout<<"\ninserting at index"<<index;
  37. cout<<"\nInput name:";gets(name[index]);
  38. cout<<"\nInput address:";gets(adr[index]);
  39. cout<<"\nInput hobbies:";gets(hobez[index]);
  40. cout<<"\nInput dislikes:";gets(ayaw[index]);
  41. cout<<"\nInput age:";cin>>age[index];index++;
  42. }
  43.  
  44. }while(choiz!=6);
  45. if(choiz==2){cout<<"\nThis Function lets you Edit Data in this slumbook:"; }
  46.  
  47. cout<<"\nInput hte name of the data to be eddited:";gets(name[index]);cout<<"\nName:"<<" ";
  48. gets(name[index]);
  49. cout<<"\nAddress:"<<" ";gets(ad[index]);
  50. cout<<"\nHobbies"<<" ";gets(hobiz[index]);
  51. cout<<"\nDislikes:"<<" ";gets(dis[index]);
  52. cout<<"\nAge:"<<" ";gets(age[index]);
  53. if(choiz==3){cout<<"\nThis Function lets you delete data in this sbook:";}
  54. if(choiz==4){cout<<"\nThis function lets you view the list of the inputted data";}
  55. cout<<"\nlisting all records:";
  56. for(int a=0;a<=14;a++){
  57. cout<<"\nName:"<<neym[a];cout<<"\nAddress:"<<adr[a];
  58. cout<<"\nHobbies:"<<hobez[a];cout<<"\nDislikes:"<<ayaw[a];
  59. cout<<"\nAge:"<<age[a];
  60. if(choiz==5){cout<<"\nThis function lets you search the data inputted:";
  61. for(int f=0;f<=14;f++){cout<<"\n"<<neym[f];cout<<"\n";adr[f];cout<<"\n"<<hobez[f];
  62. cout<<"\n";ayaw[f];cout<<"\n"<<age[f];} }
  63. if(choiz==6){cout<<"\nYou have exitted the program:";}
  64. }}}
  65.  
  66.  
  67. pls help,
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75. getch();
  76. }
Last edited by Ancient Dragon; Oct 3rd, 2008 at 7:26 am. Reason: add code tags
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,408
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1469
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: pls. help in my program

 
0
  #2
Oct 3rd, 2008
You first need to learn how to format your code -- what you posted is a huge mess which I refuse to even try to read.

delete use of conio.h and studio.h -- this is a c++ program, not C.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 675
Reputation: Sky Diploma is a splendid one to behold Sky Diploma is a splendid one to behold Sky Diploma is a splendid one to behold Sky Diploma is a splendid one to behold Sky Diploma is a splendid one to behold Sky Diploma is a splendid one to behold 
Solved Threads: 99
Sky Diploma's Avatar
Sky Diploma Sky Diploma is offline Offline
Practically a Master Poster

Re: pls. help in my program

 
0
  #3
Oct 3rd, 2008
Well You take in the data from the user and then again change it back....... With the strcopy(arg1,arg2) Function in main .
1. Please Mark Your Thread as Solved After Getting Your Answers.
2. Please Use CODE TAGS .
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 89
Reputation: bhoot_jb is on a distinguished road 
Solved Threads: 2
bhoot_jb bhoot_jb is offline Offline
Junior Poster in Training

Re: pls. help in my program

 
0
  #4
Oct 3rd, 2008
what ancient dragon said is correct. Your code isnt formatted at all. First of all, you need to learn that.

I would like to point out certain things though.

First of all, you need to decide which language you actually want to use - C or C++. It seems that you have included the iostream.h (a C++ header) file just to use 'cin' and 'cout'.

Also, i would like to point out the use of 'void main()' - The experts here had had warned me against using it. I am doing the same to you for just reasons.
Bhoot
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC