"Idea": the direct addition of the test data is the line. But I still want to try the list, data structure after a year does write a little trouble. Alas.
Note: The spelling of the node link. And p->p at the time of traversal, skimming the head node.
"AC Code":
#include <iostream> #include <algorithm> #include <string> #include <cstdio> #include < cstring>using namespace std; #define MAX 10struct node{double a;double b; Node *next;}; int main () {freopen ("In.txt", "R", stdin); int i = 0; Node *p; Node *q = p;p = q = (node*) malloc (sizeof (node)); for (i = 0; i < MAX; i++) {Node *node;node = (node*) malloc (sizeof (node)) ; CIN >> node->a >> node->b;q->next = node;q = node;} Q->next = null;double m = 0, n = 0;for (p = p->next; p! = NULL; p = p->next) {m = p->a + m;n = p->b + N;} cout << m << "+" << n << "i"; return 0;}
Blue Bridge Cup ALGO-107 9-7 linked list data summation operation (linked list)