1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
//int number,number1,sum,sum1;
//int sun[][];
int prototype(int sun[100][100],int stone,int cold,int stain,int time,int masiv1[]) {
int sum;
for(stain=0;stain<stone;stain++)
{
sum=0;
for(time=0;time<cold;time++)
{
if(time<0)
{
sum+=0;
}
else
{
sum+=sun[stain][time];
}
}
masiv1[stain]=sum;
}
}
int main ()
{
int masiv[100][100],counter,counter1,number,number1,masiva[50];
cout<<"How many rows? " && cin>>counter;
cout<<"How many columns? " && cin>>counter1;
for(number=0;number<counter;number++)
{
for(number1=0;number1<counter1;number1++)
{
cout<<"Enter the "<<number1<<" column of the "<<number<<" row " && cin>>masiv[number][number1];
}
}
prototype(masiv,counter,counter1,number,number1,masiva);
for(number=0;number<counter;number++)
{
cout<<masiva[number]<<"\n";
}
}
|