写出程序运行结果
好的,以下是各个程序的运行结果:
1. C语言程序 :
```c #include void main() { int a = 0100, b = 100; printf(\"x=%d, y=%d\\n\", --a, b++); } ```
运行结果是:`x=63, y=100`。
2. C语言程序(使用`scanf`和`switch`) :
```c #include void main() { int x, y = 0; scanf(\"%d\", &x); // 输入 4 switch(x + 1) { case 0: y += 1; break; case 3: y += 3; break; case 5: y += 5; break; default: y += 7; } printf(\"%d\\n\", y); } ```
运行结果是:`y=4`。
3. C语言程序(包含宏定义和除法) :
```c #include #define DEBUG int main() { int a = 20, b = 10, c; c = a / b; #ifdef DEBUG printf(\"%d/%d=\", a, b); #endif printf(\"%d\", c); return 0; } ```
运行结果是:`2`。
4. C语言程序(使用`for`循环和`switch`) :
```c main() { int i, j = 4; for (i = j; i <= 2 * j; i++) switch (i / j) { case 0: case 1: printf(\"*\"); break; } } ```
运行结果是:` `。
5. C#程序(包含抽象类和继承) :
```csharp using System; public abstract class A { public A() { Console.Write(\'A\'); } public virtual void Fun() { Console.Write(\"A.Fun()\"); } } public class B : A { public B() { Console.Write(\'B\'); } public override void Fun() { Console.Write(\"B.Fun()\"); } public static void Main() { A a = new B(); Console.WriteLine(); a.Fun(); } } ```
运行结果是:`AB`。
6. C语言程序(字符数组操作) :
```c #include int main() { char a[] = \"morning\", t; int i, j = 0; int k; k = sizeof(a); for (i = 1; i < 7; i++) if (a[j] < a[i]) { j = i; } t = a[j]; a[j] = a; a = t; puts(a); return 0; } ```
运行结果是:`gninro`。
7. 未提供程序的运行结果 :
```c // 该程序没有提供,因此无法给出运行结果。 ```
希望这些信息对你有所帮助。
其他小伙伴的相似问题:
C语言程序中宏定义的作用是什么?
C语言程序中抽象类和继承如何应用?
如何查看C语言程序的运行结果?