www.xzwm.net > C++编程问题 给定一个数组A[10]={1,2,3,4,5,6,7,8,...

C++编程问题 给定一个数组A[10]={1,2,3,4,5,6,7,8,...

#includeint main(){int a[10]={1,2,3,4,5,6,7,8,9,10},*p=a,*q=a+9,t; for(;p

#include using namespace std; int main(void) { int i = 0,a[8] = {1,2,3,4,5,6,7,8};for(i;i

#include#includeusing namespace std;int sum(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j){return a + b + c + d + e + f + g + h + i + j;}int average(int a, int b, int c, int d, int e, int f, int g, int h,...

#include void main() { int a[10]={1,2,3,4,5,6,7,8,9,10}; int i,k,n=10,*p=a; printf("input k="); scanf("%d",&k); for(i=k-1;i

这样写扩展性会更好,数组中的个数可以是任意的,只需修改arrSize 即可 #include using namespace std; int main() { unsigned int i = 0, j = 0, t = 0; const unsigned int arrSize = 5; int array[arrSize]; cout

#include using namespace std;int main(){int arr[20] = {0, 1, 2, 3, 4, 5, 6, 17, 18, 29};int x = 0;coutx;int i=0, j=0;for(i=0;i < 10;){if(arr[i] < x)++i;else{for(j=9;j >= i;--j)arr[j+1] = arr[j];arr[i] = x;break;}}for(i=0;i < 11...

void AddTwo(int &a) { for (int i=0;i

#include int main(){int a[20];int sum = 0;int i = 0;for (i = 0;i < 20;i ++){scanf("%d",&a[i]);sum += a[i];}sum /= 20;int temp = a[0];for (i = 1;i < 20;i ++){if (temp < a[i]){temp = a[i];}}printf("最高分:%d 平均分:%d\n",temp,s...

用CFile读入,存在相应大小的char数组,用for循环判断@字符,找到后的数组再逐个存入新数组

#include #include #define M 3 main() { int a[M][M]={1,2,3,4,5,6,7,8,9},i,j,sum=0; for(i=0;i

网站地图

All rights reserved Powered by www.xzwm.net

copyright ©right 2010-2021。
www.xzwm.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com