相反输出——C++内存空间管理
效果图: 请输入字符串个数 4 请输入n个字符串 chengshaolei chenruizi wuyongliang shanbo 输入完毕 现在反序输出 shanbo wuyongliang chenruizi chengshaolei 请按任意键继续。。。。。。。。
/*
功能:内存空间管理——相反输出
日期:2013-09-08
*/
#include<iostream>
using namespace std;
int main(void)
{
int n,i,j;
char Ch[1000][1000];
//输入
cout << "请输入字符串个数:n" << endl;
cin >> n;
cout << "请输入n个字符串:n" << endl;
for (i=0;i<n;i++)
{
cin >> Ch[i];
}
//输出
cout << "现在反序输出:n" << endl;
for (i=n-1;i>=0;i--)
{
cout << Ch[i] <<endl;
}
//结束
system("pause");
return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
预览
除特别注明外,本站所有文章均为 Windcoder网 原创,转载请注明出处来自: memory-space-management-contrary-output-c
Loading comments...

预览
c++,我也在学
来踩踩了,看博主的文章写了比较多的c++啊,最近写c++,我们公司最近也要求学习c#了!加油啊~
回复 @aTool: (*^__^*) 嘻嘻……,嗯哪,加油
不错 喜欢c加加 不过学不会
回复 @晨曦: <a href="#div-comment-21" rel="nofollow">@晨曦 </a>其实我也是初学者