943,741 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 4109
  • C++ RSS
You are currently viewing page 3 of this multi-page discussion thread; Jump to the first page
May 10th, 2009
0

Re: Pressing a Button makes a new thing

So are there any other things involved apart from Counting the number of Customers?
Reputation Points: 673
Solved Threads: 125
Practically a Posting Shark
Sky Diploma is offline Offline
818 posts
since Mar 2008
May 10th, 2009
0

Re: Pressing a Button makes a new thing

what if I don't use a vector of auto_ptrs
Reputation Points: 10
Solved Threads: 0
Junior Poster
BlackStar is offline Offline
188 posts
since Apr 2009
May 10th, 2009
0

Re: Pressing a Button makes a new thing

well ask the customer what they want.
then once they are done.
they get removed from the line.
Reputation Points: 10
Solved Threads: 0
Junior Poster
BlackStar is offline Offline
188 posts
since Apr 2009
May 10th, 2009
0

Re: Pressing a Button makes a new thing

So How Do you want to exit from the program.

Let us assume that You want to exit when you press 'x';

so
C++ Syntax (Toggle Plain Text)
  1. char action;
  2. while(action!=x)
  3. {
  4. cin>>action;
  5. switch(action)
  6. {
  7. case 'c':
  8. case 'C':
  9. //do something over here;
  10. }
  11.  
  12.  
  13. }
That would be the appropriate code.

What was wrong with you code was that the while loop was only focused on one single action
Reputation Points: 673
Solved Threads: 125
Practically a Posting Shark
Sky Diploma is offline Offline
818 posts
since Mar 2008
May 10th, 2009
0

Re: Pressing a Button makes a new thing

Click to Expand / Collapse  Quote originally posted by BlackStar ...
what if I don't use a vector of auto_ptrs
Then you're making it yourself difficult, but why don't you just get the whole line of 'c's first? The only thing left then is count how many times the 'c' occurred and use dynamic memory allocation to allocate the appropriate amount of memory for it ...
Reputation Points: 2125
Solved Threads: 243
Postaholic
tux4life is offline Offline
2,105 posts
since Feb 2009
May 10th, 2009
0

Re: Pressing a Button makes a new thing

Click to Expand / Collapse  Quote originally posted by tux4life ...
Then you're making it yourself difficult, but why don't you just get the whole line of 'c's first? The only thing left then is count how many times the 'c' occurred and use dynamic memory allocation to allocate the appropriate amount of memory for it ...
I think that using vector of customers would be more appropriate for this .

Black Star Uses character based input and not string based because, Its like a real Shop Scenario.
WHERE CUSTOMERS CAN arrive at any point of time.
Reputation Points: 673
Solved Threads: 125
Practically a Posting Shark
Sky Diploma is offline Offline
818 posts
since Mar 2008
May 10th, 2009
0

Re: Pressing a Button makes a new thing

I think that using vector of customers would be more appropriate for this .
Yeah that's absolutely right, I was so much into 'thinking in pointers' that I just forgot about doing it in the easy way

Black Star Uses character based input and not string based because, Its like a real Shop Scenario.
WHERE CUSTOMERS CAN arrive at any point of time.
I finally fully understand what he's trying to do, in this case using vectors is definitely the way he should go !!
Last edited by tux4life; May 10th, 2009 at 4:21 pm.
Reputation Points: 2125
Solved Threads: 243
Postaholic
tux4life is offline Offline
2,105 posts
since Feb 2009
May 10th, 2009
0

Re: Pressing a Button makes a new thing

I'm new..
Is memory leak problem solved..
Reputation Points: 47
Solved Threads: 69
Posting Whiz
cikara21 is offline Offline
340 posts
since Jul 2008
May 10th, 2009
0

Re: Pressing a Button makes a new thing

Click to Expand / Collapse  Quote originally posted by cikara21 ...
I'm new..
Is memory leak problem solved..
We don't know, if he'll use vectors, the memory leak and his whole problem will be solved immediately
Last edited by tux4life; May 10th, 2009 at 4:25 pm.
Reputation Points: 2125
Solved Threads: 243
Postaholic
tux4life is offline Offline
2,105 posts
since Feb 2009
May 10th, 2009
0

Re: Pressing a Button makes a new thing

I'm sticking with Link list tho @_@
Reputation Points: 10
Solved Threads: 0
Junior Poster
BlackStar is offline Offline
188 posts
since Apr 2009

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: I got stuck on loading the matrix from file
Next Thread in C++ Forum Timeline: A problem with dynamic allocation..help please





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


Follow us on Twitter


© 2011 DaniWeb® LLC