HELP!!

How do I fix this code so that when a user inputs the row they want to find the sum of they find the sum of only that row?

For example, if the user enters 1; the sum of row 1 only appears.
1
2
3
4
5
6
7
8
9
  cout << "Enter row index 0-2:" << endl;
        cin >> index;
    for(i=0;i<=index;i++)
    {for(j=0;j<4;j++)
        s=s+a[i][j];
        cout<<"The sum of all row "<<i<<" numbers is "<< s;
        s=0;
        cout<<endl;
    }
1
2
3
4
5
6
7
8
9
 cout << "Enter row index 0-2:" << endl;
 cin >> index; 
 s=0;
 for(j=0;j<4;j++)
{
     s=s+a[index][j];
     cout<<"The sum of row "<<index <<" numbers is "<< s;
     cout<<endl;
 }
Topic archived. No new replies allowed.