您的位置:首页 > 其它

Problem B: 使用指针访问数组元素--程序填空

2016-03-13 12:58 405 查看



Time Limit: 1 Sec Memory Limit: 128 MB

Submit: 596 Solved: 322

[Submit][Status][Web
Board]

Description

输入10个整数值到数组中,使用指针来完成对这10个数组元素的逆向输出。

在下面代码的基础上完成,提交时只提交begin之后和//end之前的代码。
/*C++*/
#include <iostream>
using namespace std;
int main()
{
int a[10];
int *p;
p=a;
int i;
for(i=0;i<10;i++) //begin
cin>>
;
//逆序输出数组元素
for(
; ; ) //end
cout<<*p<< " ";

return 0;
}
/*C语言*/
#include<stdio.h>

int main()

{

int a[10];

int *p;

p=a;

int i;

for(i=0;i<10;i++) //begin

scanf( );

//逆序输出数组元素

for( ; ;
) //end

printf("%d ",*p);

return 0;

}

Input

10个整数

Output

这10个整数的逆向输出

Sample Input

0 1 2 3 4 5 6 7 8 9

Sample Output

9 8 7 6 5 4 3 2 1 0

HINT

合理的使用指针来完成对数组元素的访问

提交时只提交begin之后和//end之前的代码

[Submit][Status][Web
Board]
한국어
中文
فارسی English
ไทย

Anything about the Problems, Please Contact Admin:admin

All Copyright Reserved 2010-2014
HUSTOJ TEAM

GPL2.0 2003-2014
HUSTOJ Project TEAM
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: