a c++ solution

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

Join Date: Jan 2009
Posts: 476
Reputation: csurfer is just really nice csurfer is just really nice csurfer is just really nice csurfer is just really nice csurfer is just really nice 
Solved Threads: 76
csurfer's Avatar
csurfer csurfer is offline Offline
Posting Pro in Training

Re: a c++ solution

 
0
  #11
Jul 4th, 2009
  1. main()
  2. {
  3. int x,n, count=0;
  4.  
  5. n=n+1
  6. nxt: cout<<"x=..";
  7. cin>>x;
  8. if(x>60)
  9. count=count+1;
  10. if(n==10)
  11. cout<<count;
  12. else
  13. goto nxt;
  14. }
You really sure that this is a code ??? Because I don't see any thing that this program can do... All I see is C++ being used. Not only you but any sensible person might find this program totally senseless...Its really hard even for us to know its LOGIC. Nothing is connected over here it is testing something which is never set and never even dealt with.Just loops around random number of times.

What did you really write this program for ???
Last edited by csurfer; Jul 4th, 2009 at 12:12 pm.
I Surf in "C"....
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: a c++ solution

 
0
  #12
Jul 4th, 2009
To the OP:
How do you think variable n will ever get value 10 ?
You never explicitly put a value in it.

n will never become ten, so you can rip this out of your code, and it will work in exactly the same way.
  1. if(n==10)
  2. cout<<count;

>Its really hard even for us to know its LOGIC.
The LOGIC is: there's no LOGIC
Last edited by tux4life; Jul 4th, 2009 at 12:20 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  
Reply

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



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC