943,832 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 505
  • C++ RSS
Oct 3rd, 2008
0

pls. help in my program

Expand Post »
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:
C++ Syntax (Toggle Plain Text)
  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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nrew is offline Offline
1 posts
since Oct 2008
Oct 3rd, 2008
0

Re: pls. help in my program

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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,951 posts
since Aug 2005
Oct 3rd, 2008
0

Re: pls. help in my program

Well You take in the data from the user and then again change it back....... With the strcopy(arg1,arg2) Function in main .
Reputation Points: 673
Solved Threads: 125
Practically a Posting Shark
Sky Diploma is offline Offline
818 posts
since Mar 2008
Oct 3rd, 2008
0

Re: pls. help in my program

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.
Reputation Points: 57
Solved Threads: 2
Junior Poster in Training
bhoot_jb is offline Offline
89 posts
since Mar 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Error C2440: Char Array Addressing Problem
Next Thread in C++ Forum Timeline: Vector Dimensions





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC