C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 18th, 2006, 07:57 PM
devshaikh11 devshaikh11 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 7 devshaikh11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 57 m 39 sec
Reputation Power: 0
Send a message via ICQ to devshaikh11
Arrow Need Instructions on HOW to debug this small code

Hi,

I wish to use the Visual C++ debug feature to get a better idea on what exactly goes on step by step when this code (shown below) is run, and how my variables are affected.

My request is: Can someone instruct me on how to use the debug feature for the stated purpose?

Or can someone please direct me to a comprehensive guide for doing so?

My thanks in advance.

Code:
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
	char next;

	cout << ": ";
	cin.get(next);
	while (next != ' ')
	{
		cout.put(next);
		cin.get(next);
	}
	cin.putback(next);

	cout << endl;
	return 0;
}

Reply With Quote
  #2  
Old January 18th, 2006, 09:26 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
I dont really ever use the debug function but what exactly are you trying to get out of it. Are you just trying to see what your program is doing, step by step? Because this code is fairly basic, the first cin.get(next) starts the loop then the while loop, loops until the user presses enter. Then the cin.putback(next) prints what the user entered. Instead of while(next != ' ') you could use '\n' because the while will not stop just because the user presses the space key. So if you are just trying to explore your compiler I'm sorry I probably cant help you there but I hope this explanation helps you.
__________________
---Official Member Of The Itsacon Fan Club---
Give a man a fish and he will eat for a day. Teach a man to fish and he will sit in a boat all day drinking beer.

Reply With Quote
  #3  
Old January 19th, 2006, 07:30 PM
devshaikh11 devshaikh11 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 7 devshaikh11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 57 m 39 sec
Reputation Power: 0
Send a message via ICQ to devshaikh11
Quote:
Originally Posted by Geo.Garnett
Are you just trying to see what your program is doing, step by step?


Exactly. Yes, I know the code is fairly basic. However I am having trouble using the debugger to follow even this code. If anyone can show me how to set up the debugger so I can follow this code, please let me know. Thank you.

Reply With Quote
  #4  
Old January 19th, 2006, 09:11 PM
Neuro Neuro is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 7 Neuro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 47 sec
Reputation Power: 0
In one of my labs we use the Visual C/C++ debugger to both view the assembler code and also to set things like 'watch' vairables and break points.

If you don't have an answer by thursday or so I will have a look to remind myself and get back to you, as I'm not in the lab until then.

Reply With Quote
  #5  
Old January 19th, 2006, 09:25 PM
devshaikh11 devshaikh11 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 7 devshaikh11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 57 m 39 sec
Reputation Power: 0
Send a message via ICQ to devshaikh11
Quote:
Originally Posted by Neuro
In one of my labs we use the Visual C/C++ debugger to both view the assembler code and also to set things like 'watch' vairables and break points.

If you don't have an answer by thursday or so I will have a look to remind myself and get back to you, as I'm not in the lab until then.


Thanks Neuro, I appreciate it.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Need Instructions on HOW to debug this small code


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT