Home > Back-end >  C + +
C + +

Time:09-15

Is there any bosses know how to use c + + to write the code!
Urgent urgent ~
From freshman year Tony call

CodePudding user response:

In fact this is the basic knowledge of C language, can see more of my articles on this
Complete code:
 
# include "stdio.h"
Int the sum (int a [], int n) {
Int s=0;//store and
for(int i=0; iS +=a, [I].//add up each number in the array sum
return s;//the return value to the main function of main
}
The main (void) {
Int I, a [10], n, x, t;
Printf (" please enter the data number n (1, n) 10 or less or less: ");
The scanf (" % d ", & amp; N);
Printf (" please input the number: % d ", n);
for(int i=0; iThe scanf (" % d ", & amp; A [I]);
T=sum (a, n);
Printf (" and the number of these is: % d \ n ", t);
}
  • Related