作业帮 > 综合 > 作业

第3题,由1,2.3.4能…C语言大神,我需要你😭😭😭快来帮帮我

来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/08/03 08:35:46
第3题,由1,2.3.4能…C语言大神,我需要你😭😭😭快来帮帮我

 


第3题,由1,2.3.4能…C语言大神,我需要你😭😭😭快来帮帮我
#include
#include
#include
using namespace std;
int main()
{
int num[4] = {1,2,3,4};
int up = 4,count=0;
for(int i =0;i
再问: 好深奥,完全看不懂
再答: 就是枚举,思路:
1:把每一种情况列举出来,3重for循环,(优化自己想想怎么做)
2:判断这种情况是否满足要求,是的话打印
3:若几经打印6个3位数了,就换行

num[i],num[x],num[y] 表示 百位,十位,个位数字的值
++count%6 == 0 相当于 count = count + 1;count%6==0
再问: for后面的括号里写i++和++i有什么区别
再答: 相同点:都等于 i=i+1
不同点:表达式的值:
int i = 0,x=0; printf("%d",i++);printf("%d",++x);一个是零一个是一,
再 printf("%d",i);printf("%d",x);时,都打印1
再问: 最后的那个例子我没有看出什么不同呀
再答: 我的错,看下面

int a,b,x,y;
x = y = 0;
a = ++x;
b = y++;
printf("x = %d ,y = %d\n",x,y);
printf("++x = %d ,y++ = %d\n",a,b);
printf("after ++x ,y++ :\n");
printf("x = %d ,y = %d\n",x,y);

i++和++i对本身没有影响,影响的是该表达式赋值对象,例子中是a和b。

以上
再问: 谢谢,明白了