c语言运行结果 以及详解

如题所述

第1个回答  2015-04-02
#include <stdio.h>

int main(int argc, char const *argv[])
{
  int a, b, c, s, w, t;
  s = w = t = 0;
  a = -1; b = 3; c = 3;
  if (c > 0) s = a + b; // 此时c值为3 满足 结果s = a + b = -1 + 3 = 2
  if (a <= 0) // 此时a值为-1 满足 下面的else if和else 不再执行
  {
    if (b > 0)  // 此时b值为3 满足
      if (c <= 0) w = a - b;  // 此时c值为3 不满足
  }
  else if (c > 0) w = a - b;
  else t = c;
  printf("%d %d %d\n", s, w, t);  // 输出结果2 0 0
  return 0;
}

本回答被提问者采纳
第2个回答  2015-04-02

第3个回答  2015-04-02
这么简单都不会么,自己用VC实验吧本回答被网友采纳
相似回答