房天下 > 房天下问答 > 业主生活 > 其他
  • 一道C++题

    定义一个二维数组,通过键盘给它赋值,然后再以矩阵的格式显示出来。帮忙编下,我一点也不会,谢谢!

    提问者:蓝闲警察

    发布于2010-12-07

共1个回答
  • sunmooner 丨Lv 3
    #include <iostream>using namespace std;int main(int argc, char *argv[]){ int var[5][5]; for(int i = 0; i < 5; ++i){ for(int j = 0; j < 5; ++j){ cin >> var[i][j]; }/*------end of for------*/ }/*------end of for------*/ for(int i = 0; i < 5; ++i){ for(int j = 0; j < 5; ++j){ cout << var[i][j] << " "; }/*------end of for------*/ cout << endl; }/*------end of for------*/ } /*------end of main------*
    +1 2010-12-07 举报
热门人气推荐
免责声明:问答内容均来源于互联网用户,房天下对其内容不负责任,如有版权或其他问题可以联系房天下进行删除。