正在加载图片...
C++语言程序设计 清华大学郑莉 例6.1一维数组的声明与3引用 数 #include <iostream> using namespace std; int main() inta[10],b[1o]; 组 for(int i=0;i<10;i++){ ai=i*2-1: b[10-i-1]=a[i]; for(int i=0;i 10;i++) cout〈<"a[”(<i<"]= <a[i门(<"”" cout<"b[”<I〈<"j=”(<biij(<endl; return 0; C++语言程序设计 清华大学 郑莉 5 例6. 1一维数组的声明与引用 #include <iostream> using namespace std; int main() { int a[10], b[10]; for(int i = 0; i < 10; i++) { a[i] = i * 2 - 1; b[10 - i - 1] = a[i]; } for(int i = 0; i < 10; i++) { cout << "a[" << i << "] = " << a[i] << " "; cout << "b[" << I << "] = " << b[i] << endl; } return 0; } 数 组
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有