多维数组求和怎么起名字
//sum是把每一行的和全统计出来了,怎么比较sum中每一行和的大小或者怎么命名#include<iostream>
using namespace std;
int main()
{ double c[3][3] = {};
string a[]= {"张","关","羽"};
string b[]= {"语","数","外"};
for(int i=0; i<3; i++)
{ for(int j=0; j<3; j++)
{
cout << a[i] << "的"<<b[j]<<"成绩"<<"";
cin >> c[i][j];
}
}
cout << "\t" ;string namesum="总和";
for(int i=0; i<3; i++)
{ cout << b[i] << "\t";
}
cout << namesum <<"\t";
cout<< endl;
for(int i=0; i<3; i++)
{ int sum=0;
cout << a[i] <<"\t";
for(int j=0; j<3; j++)
{ sum=sum+c[i][j];
cout <<c[i][j]<<"\t";
}
cout <<sum<<"\t";
cout <<endl;
}
}