帮助Visual Studio初学者----是否可以逐行浏览C程序以查看变量如何变化?这称为“追踪"吗?或“逐步执行"或者是其他东西? [英] Help a Visual Studio Beginner ---- Is it possible to go through a C program line-by-line to see how variables change? Is this Called "Tracing" or "Stepping Through" or Something Else?

查看:104
本文介绍了帮助Visual Studio初学者----是否可以逐行浏览C程序以查看变量如何变化?这称为“追踪"吗?或“逐步执行"或者是其他东西?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我在一个类似的论坛上问了这个问题,并确定我无法使用Arduino IDE来做到这一点.

I asked this question on a similar forum, and determined that I couldn't do this with the Arduino IDE.

我相信我可以用C做到这一点.我希望有人可以向我指出一些资源,向我展示如何做到这一点?

I believe I can do it with C. I was hoping someone could point me to some resources show me how to do it?

在下面粘贴了我的其他帖子: http://forum.arduino.cc/index.php?topic=439536.0

Pasted my other post below:  http://forum.arduino.cc/index.php?topic=439536.0

--------------------------------------------------- -------------------------------------------------- ------------------------

-------------------------------------------------------------------------------------------------------------------------

对于这样的基本问题深表歉意.

我对能够通过几个C程序行感兴趣-逐行,并查看变量在每个行和循环周期中如何变化.  (我在下面提供了这些程序.作为初学者,它们对我而言不是立即直观的,我认为拥有此功能可以帮助我识别正在发生的事情)
我想我已经在Lynda.com上通过调试器看到了此内容使用JavaScript使用Firebug

我认为描述此过程的词叫跟踪"?  不是吗? 确定我是否有正确的词来指导我的Google搜索教程
哪些IDE可以执行此操作?我认为大多数都会.  我目前有Arduino IDE,Visual Studio(具有C/C ++支持)和CodeBlocks (还具有C/C ++支持)安装在我的计算机上

此外,如果有人有任何可能与之相关的教程或一般指针


我要逐行浏览的程序:

Sorry for such an elementary question.

I am interested in being able to go through a couple of C programs line-by-line, and seeing how the variables change with each line and loop cycle.  (I included the programs below. They are not immediately intuitive to me as a beginner and I think having this ability could help me discern what's going on)

I think I have seen this done with a debugger on a Lynda.com with Firebug using JavaScript

I think the word describing this process is called "tracing"? Is that right? Not sure if I have the right word to direct my Google searches for tutorials

What IDEs are capable of doing this? I assume most will.   I currently have Arduino IDE, Visual Studio (with C/C++ support), and CodeBlocks (also with C/C++ support) installed on my machine

Also, if anyone has any tutorials or general pointers that think might be relevant I would be greatly appreciative!


Programs that I want to go through line-by-line:

--------------------------------------------------- -------------------------------------------------- ----------

-----------------------------------------------------------------------------------------------------------

#include< stdio.h> ;

#define TRUE 1
#define假0

typedef int Bool;


main()
{
  布尔digit_seen [10] = {0};
   int digit;
             span>

   printf("输入数字:");
   scanf(%ld" ;,& n);

  while(n> 0 ){
    digit = n%10;
    if(digit_seen [digit])

      break;
    digit_seen [digit] = TRUE;
    n/= 10;
  }

  if(n> 0 )
    printf(重复数字\ n \ n");
   else
    printf(没有重复的数字\ n \ n");
  返回0;
}

#include <stdio.h>

#define TRUE 1
#define FALSE 0

typedef int Bool;


main()
{
  Bool digit_seen[10] = {0};
  int digit;
  long int n;

  printf("Enter a number: ");
  scanf("%ld", &n);

  while (n > 0) {
    digit = n % 10;
    if (digit_seen[digit])
      break;
    digit_seen[digit] = TRUE;
    n /= 10;
  }

  if (n > 0)
    printf("Repeated digit\n\n");
  else
    printf("No repeated digit\n\n");

  return 0;
}

--------------------------------------------------- -------------------------------------------------- -

--------------------------------------------------------------------------------------------------

第二个程序:

#include < stdio.h>
#include < ctype.h>           /*用于访问toupper函数*/
main()
{




数字 = ch-'0';                    /*相当于ch-48  */
股息 =(剩余* 10)+数字;
如果 (股息> = 7)
else

remainder = (dividend - digit)/10;       /* We recover the reminder before using the check digit */

if (remainder == digit)
printf("VALID\n");
else
printf("INVALID\n");

printf("ch: %d\n", ch);
printf("digit: %d\n", digit);
printf("dividend: %d\n", dividend);
printf("remainder: %d\n", remainder);

return 0;
}

#include <stdio.h>
#include <ctype.h>           /* for access to the toupper function */

main()
{
char ch;                                 /*char is the ticket number */
int digit;                               /*digit represents the last digit in ticket number */
int dividend;
int remainder = 0;                       /*remainder is the remainder of (sum of all but last digit) % 7 */

printf("Enter ticket number: ");

while ((ch = getchar()) != '\n')  {       /* The solution relies on the fact that the ASCII characters are ordered and that '0' to '9' are consecutive ASCII codes. So if you want to know the value of '7' you simply subtract the value '0' from it to get 7, as has already been stated. The same is true for the letters 'a' to 'z' and 'A' to 'Z', they are all in alphabetic order */


digit = ch - '0';                    /* equivalent to ch - 48  */

dividend = (remainder * 10) + digit;

if (dividend >= 7)
remainder = dividend % 7;
else
remainder = dividend;
}

remainder = (dividend - digit) / 10;       /* We recover the reminder before using the check digit */

if (remainder == digit)
printf("VALID\n");
else
printf("INVALID\n");

printf("ch: %d\n", ch);
printf("digit: %d\n", digit);
printf("dividend: %d\n", dividend);
printf("remainder: %d\n", remainder);

return 0;
}

推荐答案

Hi!

You have all informations in this link : https://msdn.microsoft.com/en-us/library/dn986851.aspx?f=255&MSPPError=-2147217396

You have all informations in this link : https://msdn.microsoft.com/en-us/library/dn986851.aspx?f=255&MSPPError=-2147217396

If it's good for you, can you mark this answer as answer of your question please?



这篇关于帮助Visual Studio初学者----是否可以逐行浏览C程序以查看变量如何变化?这称为“追踪"吗?或“逐步执行"或者是其他东西?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆