Pressing a Button makes a new thing

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

Join Date: Mar 2008
Posts: 672
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: Pressing a Button makes a new thing

 
0
  #21
May 10th, 2009
So are there any other things involved apart from Counting the number of Customers?
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: Apr 2009
Posts: 186
Reputation: BlackStar is an unknown quantity at this point 
Solved Threads: 0
BlackStar BlackStar is offline Offline
Junior Poster

Re: Pressing a Button makes a new thing

 
0
  #22
May 10th, 2009
what if I don't use a vector of auto_ptrs
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 186
Reputation: BlackStar is an unknown quantity at this point 
Solved Threads: 0
BlackStar BlackStar is offline Offline
Junior Poster

Re: Pressing a Button makes a new thing

 
0
  #23
May 10th, 2009
well ask the customer what they want.
then once they are done.
they get removed from the line.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 672
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: Pressing a Button makes a new thing

 
0
  #24
May 10th, 2009
So How Do you want to exit from the program.

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

so
  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
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: Feb 2009
Posts: 1,968
Reputation: tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute 
Solved Threads: 214
tux4life's Avatar
tux4life tux4life is offline Offline
Posting Virtuoso

Re: Pressing a Button makes a new thing

 
0
  #25
May 10th, 2009
Originally Posted by BlackStar View Post
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 ...
"Never argue with idiots, they just drag you down to their level and then beat you with experience."
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 672
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: Pressing a Button makes a new thing

 
0
  #26
May 10th, 2009
Originally Posted by tux4life View Post
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.
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: Feb 2009
Posts: 1,968
Reputation: tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute 
Solved Threads: 214
tux4life's Avatar
tux4life tux4life is offline Offline
Posting Virtuoso

Re: Pressing a Button makes a new thing

 
0
  #27
May 10th, 2009
Originally Posted by Sky Diploma View Post
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

Originally Posted by Sky Diploma View Post
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.
"Never argue with idiots, they just drag you down to their level and then beat you with experience."
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 320
Reputation: cikara21 is an unknown quantity at this point 
Solved Threads: 63
cikara21's Avatar
cikara21 cikara21 is offline Offline
Posting Whiz

Re: Pressing a Button makes a new thing

 
0
  #28
May 10th, 2009
I'm new..
Is memory leak problem solved..
.:-cikara21-:.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 1,968
Reputation: tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute 
Solved Threads: 214
tux4life's Avatar
tux4life tux4life is offline Offline
Posting Virtuoso

Re: Pressing a Button makes a new thing

 
0
  #29
May 10th, 2009
Originally Posted by cikara21 View Post
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.
"Never argue with idiots, they just drag you down to their level and then beat you with experience."
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 186
Reputation: BlackStar is an unknown quantity at this point 
Solved Threads: 0
BlackStar BlackStar is offline Offline
Junior Poster

Re: Pressing a Button makes a new thing

 
0
  #30
May 10th, 2009
I'm sticking with Link list tho @_@
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