A TV channel rating company requires a small computerized system to store and
analyze total no of TV viewers for different time slots throughout the day among few
popular TV Channels. There are 10 popular TV Channels and the survey was conducted
during a month for one hour time slots from 4.00pm to 11.00pm.
Write a program in C for the following:
(i.) Input data to a Matrix U [M, N].
(ii.) Find the sum of the TV viewers for each time slot and store the results in a Vector V [M].
(iii.) Find the sum of the TV viewers for each channel and store the results in a Vector W [N].
(iv.) Use the Vector V [M] to find the best time slot.( best time slot should have viewers
for each channel).
(v.) Use the Vector W [N] to find the best Channel.( best Channel should have viewers
for each time slot).
(vi.) Calculate total number of viewers for that month.
Hint: write separate functions to each and every activity and call them in the main function
I Can't understand how to do iv and v parts of that question...
This is my Existing code
#include <stdio.h>
#include <conio.h>
#define M 3 /*row*/
#define N 4/*column*/
void addingdata(int array[M][N]);
void addmatrix(int array[M][N], int arr [M]);
void findmax(int a[M],int x);
int main(){
// clrscr();
int U[M][N]={0};
int V[M]={0};
// int W[N]={0};
int b=0;
addingdata(U);
addmatrix(U,V);
findmax(V,B)/>;
// printf("%d",B)/>;
getch();
}
// Starting Functions.....
void addingdata(int array[M][N]){
for (int i =0; i<M; i++){
for ( int j=0; j<N; j++){
printf("Input your value to [%d] th [%d] th location : ",i,j);
scanf("%d",&array[i][j]);
}
}
}
void addmatrix(int array[M][N],int arr[])
{
for(int j=0; j<M ; j++){
for(int k=0; k<N; k++){
arr[j]+=array[j][k];
}
printf("%d \t",arr[j]);
}
printf("\n\n\n\n");
}
// Find my Max ... ... ...
void findmax (int f[M], int c){
c=f[0];
for (int i=1; i<M; i++){
if (c<f[i]){
c=f[i];
}
}
printf("%d",c);
}
//End of max........
// End of functions....
Please help me to do this...

New Topic/Question
Reply




MultiQuote





|