第一题#include using namespace std;int main(){ const int row = 5; const int col = 5; int val = 1; int a[row][col] = {0}; for (int i=0; i!=row; ++i) {
for (int j=0; jusing namespace std;int main(){ const int row = 6; const int col = 5; int val[row][col] = {{1001,90,80,85,0},
{1002,70,75,80,0},
{1003,65,70,75,0},
{1004,56,78,97,0},
{1005,80,90,70,0}}; for (int i=0; i<row-1; ++i) {
for (int j=1; j<col-1; ++j){
val[col-1] += val[j]; } } for (int j=1; j<col-1; ++j) {
for(int i=0; i<row-1; ++i){
val[row-1][j] += val[j];} } for (int i=0; i<row; i++) {
for(int j=0; j<col; j++){
cout << val[j] << "\t";}cout << endl; } system("pause");} 我是用VC++2008的,如果你是用其他的编译器,把system("pause");去掉,如果是用以前的标准的话把头文件改成iostream.h,把using namespace std;去掉应该可以了,不懂可以问我
|