solutions21 - CSCI-1100 Computer Science I Rensselaer...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI-1100 Computer Science I Rensselaer Polytechnic Institute Spring 2004 Studio 21 -- Solutions #include <iostream> using namespace std; // Function prototypes int sumcol(int ss[ ][100], int col, int numrows); int sumrow(int ss[ ][100], int row, int numcols); int main () //PURPOSE: read a spreadsheet and sum its rows and columns //PRECONDITIONS: none //POSTCONDITIONS: displays the spreadsheet and the sums of its // rows and columns { int ss[100][100]; // spreadsheet int numrows; // number of rows in spreadsheet int numcols; // number of columns in spreadsheet int j,k; // loop variables // Get the size of the spreadsheet cout << "Enter number of rows (<= 100): "; cin >> numrows; cout << "Enter number of columns(<=100): "; cin >> numcols; // Read in the spreadsheet cout << "Enter data for spreadsheet:" << endl; for (j=0; j<numrows; j++) { for (k=0; k<numcols; k++) { cin >> ss[j][k]; } } // Display spreadsheet and sums of rows cout << endl << endl << "Sums of Rows and Columns" << endl;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

solutions21 - CSCI-1100 Computer Science I Rensselaer...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online