hotel management project

problem in my c++ hotel management project

Page 1 of 1

7 Replies - 14265 Views - Last Post: 14 December 2010 - 10:27 AM Rate Topic: -----

#1 kumarrags2004  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 13-December 10

hotel management project

Posted 13 December 2010 - 11:24 AM

In my project add and modify and delete functions in customer records in edit menu are not working properly as the contents are not being displayed .sometimes 1 record is displayed and others are not ans sometimes no records are displayed.could you resolve the problem.please check if the delete is also working after making the corrections.room records in edit menu are working fine.please reply soon.it would be really greatful.the code is attached to this post.
thanks

Spoiler


MOD EDIT: Moved code into post. Don't attach your code to a post, copy and paste it INTO the post using code tags, as shown below:

:code:

Later spoilered huge amount of code

Attached File(s)


This post has been edited by JackOfAllTrades: 14 December 2010 - 09:45 AM


Is This A Good Question/Topic? 0
  • +

Replies To: hotel management project

#2 Salem_c  Icon User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 1709
  • View blog
  • Posts: 3,288
  • Joined: 30-May 10

Re: hotel management project

Posted 13 December 2010 - 11:36 AM

> int ch ;

> while(ch!=3)

What if the uninitialised value in ch is 3 ?

> if ( ch == 3 )

> main_menu();

You should really look into call/return here
main_menu (calls)-> edit_records -> main_menu -> edit_records -> main_menu -> edit_records -> do you see what's going on here?

The edit_records() function should just return, and it is back in main_menu() where you called it from.

You do this in some other places as well.



> char string[3],string1[3],string2[3],string3[3];

> strcpy(string,"SS");

> strcpy(string1,"DSS");

Another prime example of why you should be using std::string in your C++ program.
You have OVERRUN the end of your array.
Was This Post Helpful? 2
  • +
  • -

#3 kumarrags2004  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 13-December 10

Re: hotel management project

Posted 14 December 2010 - 01:12 AM

could you just make the solution more simpler to understand.i cant find out the corrrections i have to make with the info u have given.pls if u could make the changes and post the program it would be really greatful or just pls tell me specific places i need to make the corrections.
thanks.
Was This Post Helpful? 0
  • +
  • -

#4 janotte  Icon User is offline

  • code > sword
  • member icon

Reputation: 990
  • View blog
  • Posts: 5,141
  • Joined: 28-September 06

Re: hotel management project

Posted 14 December 2010 - 01:30 AM

I've got another idea.

How about you make your best try at taking the excellent advice from Salem_c on board and make your best effort at fixing your program.

If, after trying hard to fix it, you are still having trouble then post your new code and answer these questions about that new code.
( a ) Does your code compile?
( b ) Any errors or warnings? If there are then share them with us.
Copy and paste the errors exactly as they are.
( c ) Is the program producing any output?
( d ) How is the actual output different to what you want / expect?
Give details and, ideally, examples.
If you provided inputs to the program tell us what they were.
( e ) What have you already tried to fix it?


While I am sure you would be grateful if someone fixed your program (homework?) for you that is not the way things are done at DIC.
And if it is homework and your teacher is one of the many teachers who visit this site then if we fixed it for you then you will get a fail and maybe expelled for cheating. You have some decent work here that would probably get some part marks even in its current state so throwing that away would be a very silly thing to have happen to you after all this work you have done.

BTW
"void main()" is wrong. Always wrong.
Always use "int main()".
Read here the words of the man who invented C++:
http://www.research.....html#void-main
Can I write "void main()"?
The definition void main() { /* ... */ } is not and never has been C++, nor has it ever been C. See the ISO C++ standard 3.6.1[2] or the ISO C standard 5.1.2.2.1.

And read here about some of the problems void main() can cause
http://www.gidnetwork.com/b-66.html
Was This Post Helpful? 1
  • +
  • -

#5 kumarrags2004  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 13-December 10

Re: hotel management project

Posted 14 December 2010 - 03:38 AM

i could not fully understand what salem_c had posted.there is no syntax error so the program is compiling. the problem in the program attached to the post is in the following code and the errors are attached to this post:

Spoiler

the customer records are not being displayed.refer all the photos.the customer.dat file is still storing data but is not displaying the contents.there is no problem in the room records.i am also attaching the customer.dat file as a txt filee.
pls help.
thanks

MOD EDIT: Spoilered huge amount of code

Attached image(s)

  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image

Attached File(s)


This post has been edited by JackOfAllTrades: 14 December 2010 - 09:46 AM

Was This Post Helpful? 0
  • +
  • -

#6 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6081
  • View blog
  • Posts: 23,557
  • Joined: 23-August 08

Re: hotel management project

Posted 14 December 2010 - 06:03 AM

In what can hardly be considered a surprise, it appears this code originated from an Indian homework dumping ground, so we have another copy/paste robot, explaining the tack the topic has taken.
Was This Post Helpful? 1
  • +
  • -

#7 kumarrags2004  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 13-December 10

Re: hotel management project

Posted 14 December 2010 - 08:24 AM

hey i am a school student am i have made changes of data file handling and to a large extent and logic also.the bigger part is the entering values part and problem is data file handling not copy part.pls help
Was This Post Helpful? 0
  • +
  • -

#8 Salem_c  Icon User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 1709
  • View blog
  • Posts: 3,288
  • Joined: 30-May 10

Re: hotel management project

Posted 14 December 2010 - 10:27 AM

I could ask you to read this -> http://cboard.cprogr...nt-process.html
One of the essential points of programming (which you haven't grasped yet) is to NOT code outside your ability.

If your limit is say 10 lines with a 50% chance of messing up, then that is what you need to write, compile AND TEST before moving on. Slow measured progress will get it done, and help you learn how to increase the step size (say 20 lines at a time).
50% done, 100% tested is in far better shape than 100% written, 0% tested.

And if you don't know how to fit something into your large program, then write a small test program to test your ideas until you do understand it. Then if you get stuck, you have something small and FOCUSSED on a specific issue to post.

Because let me assure you, writing 000's of lines of code and dumping it on a forum for someone else to fix is NOT a long term strategy that will work out for you.

My suggestion is you take your original source (again) and this time make smaller changes. While doing that, make sure you test and understand what it is that you're trying to achieve.

> pls if u could make the changes and post the program it would be really greatful
My rate is US$100 / Hour, even if I were inclined to spend hours on the problem.
Was This Post Helpful? 2
  • +
  • -

Page 1 of 1