fig04_05.cpp

来自「经典vc教程的例子程序」· C++ 代码 · 共 23 行

CPP
23
字号
// Fig. 4.5: fig04_05.cpp
// Initialize array s to the even integers from 2 to 20.
#include <iostream.h>
#include <iomanip.h>

int main()
{
   const int arraySize = 10;
   int j, s[ arraySize ];

   for ( j = 0; j < arraySize; j++ )   // set the values
      s[ j ] = 2 + 2 * j;

   cout << "Element" << setw( 13 ) << "Value" << endl;

   for ( j = 0; j < arraySize; j++ )   // print the values
      cout << setw( 7 ) << j << setw( 13 ) << s[ j ] << endl;

   return 0;
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?