📄 arrays.cpp
字号:
//这个程序在本书所带软盘中。文件名为ARRAYS.CPP
//这个程序利用不同方法对各种数组进行定义和初始化。
#include <iostream.h>
int arrayint[100];
float f_array[20];
char ch_array[40];
long long_array[10];
double db_array[15];
unsigned int array[26];
int arrayOne[] = {10, 20, 5, 30, 1};
float array_f[3] = {1.2, 2.4, 4.5};
int arrayTwo[20] = {1, 2, 3, 4, 5};
#define max 100
int array_three[max];
const int index = 20;
float arrayf[index+10];
void main(void)
{
int count;
for (count = 0; count < 5; count++)
cout << "arrayOne[" << count << "] = " << arrayOne[count] << endl;
cout << endl;
for (count = 0; count < 20; count++)
cout << "arrayTwo[" << count << "] = " << arrayTwo[count] << endl;
cout << endl;
for (count = 0; count < 3; count++)
cout << "array_f[" << count << "] = " << array_f[count] << endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -