⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 乘法表——二位数组的使用.cpp

📁 C++Example实用的算法:包括枚举
💻 CPP
字号:
#include<iostream.h>

const int MAXCOL=10;
const int MAXROW=10;


void main()
{
	int matrix[MAXCOL][MAXROW];
	int row;
	int col;
	
	//双重循环计算数组元素,注意始末下标值
	for(row=1;row<MAXROW;row++)
		for(col=1;col<MAXCOL;col++)
		{
			matrix[row][col]=col*row;
		}
    for(row=0;row<MAXROW;row++)
	{
		for(col=0;col<MAXCOL;col++)
		{
			if((row==0)&&(col==0))
				cout<<'*';
			else if(col==0)
				cout<<row;
			else if(row==0)
				cout<<col;
			else 
				cout<<matrix[row][col];
			if(col!=MAXCOL-1)
				cout<<'\t';
		}
		cout<<"\n\n";
	}
}

⌨️ 快捷键说明

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