为何运行时结果不能全部显示出来(可能实在是太多了吧)?想请教如何把运行结果输出到指定文件,附上源代码
#include <stdio.h> #include <stdlib.h> int main() {int a,b,c,d,e,f,num;printf("Please input the digit:\n"); scanf("%d",&num); if(num<90 || num>130) {printf("There are no such numbers at all!\n"); system("pause"); exit(0); } printf("There are following possble result:\n"); for(a=1;a<=num;a++) for(b=1+a;b<=num-a;b++) for(c=1+b;c<=num-a-b;c++) for(d=1+c;d<=num-a-b-c;d++) for(e=1+d;e<=num-a-b-c-d;e++)
{ if((f=num-a-b-c-d-e)>e&&a>=1&&f<=33) printf("%d=%d+%d+%d+%d+%d+%d\n",num,a,b,c,d,e,f); }system("pause");return 0; }
#include <stdio.h> #include <stdlib.h> int main() {int a,b,c,d,e,f,num;printf("Please input the digit:\n"); scanf("%d",&num); if(num<90 || num>130) {printf("There are no such numbers at all!\n"); system("pause"); exit(0); } printf("There are following possble result:\n"); for(a=1;a<=num;a++) for(b=1+a;b<=num-a;b++) for(c=1+b;c<=num-a-b;c++) for(d=1+c;d<=num-a-b-c;d++) for(e=1+d;e<=num-a-b-c-d;e++)
{ if((f=num-a-b-c-d-e)>e&&a>=1&&f<=33) printf("%d=%d+%d+%d+%d+%d+%d\n",num,a,b,c,d,e,f); }system("pause");return 0; }