Problem B: 使用指针访问数组元素--程序填空
2016-03-13 12:58
405 查看
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
相关文章推荐
- 第三周项目4:穷举法解决组合问题
- Linux/UNIX套接字连接
- Atitit.编程语言的基础句型and汉语英文比较
- Atitit.编程语言的基础句型and汉语英文比较
- js学习--浏览器对象计时器setInterval()与setTimeout()的使用与区别
- 深入解析String intern
- Problem A: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换
- Java的三大特性:封装 & 继承 & 多态
- 机电传动控制第三周作业
- How to Add Collider to Line Renderer in Unity
- Android App增量更新(Smart App Updates)
- 羊皮书APP(Android版)开发系列(八)用户登录
- ttt
- 用AXIS2发布WebService的方法 使用eclipse插件生成服务端和客户端
- linux系统下的软件管理(转)
- atitit.taskService 任务管理器的设计 v1
- 后台进程整理
- atitit.taskService 任务管理器的设计 v1
- atitit.taskService 任务管理器的设计 v1
- 关于playframework2.5