解题思路:
注意事项:
参考代码:
#include<stdio.h> #include<malloc.h> #include<stdlib.h> #define I sizeof(struct a) struct a{ int s; int x; struct a *next; }; int main(){ struct a *head,*a1,*a2; int n,m,i,sum1=0,sum2=0; scanf("%d",&n); head=(struct a *)malloc(I); head->next=NULL; a2=head; for(m=0;m<n;m++){ a1=(struct a *)malloc(I); scanf("%d",&a1->s); scanf("%d",&a1->x); a2->next=a1; a2=a1; } a2->next=NULL; for(i=0;i<n;i++){ head=head->next; sum1=head->s+sum1; sum2=head->x+sum2; } printf("%d+%di",sum1,sum2); }
0.0分
1 人评分
不会做的浏览:874 |
输出正反三角形 (C语言代码)格式错误!!!浏览:1140 |
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:604 |
1231题解(注意理解“输入多个测试实例”)浏览:788 |
C语言训练-列出最简真分数序列* (C语言代码)浏览:608 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:560 |
C语言程序设计教程(第三版)课后习题7.5 (C语言代码)浏览:720 |
马拦过河卒 (C语言代码)浏览:1095 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:511 |
P1001 (Java代码)浏览:691 |