. Write a program using two-dimensional arrays that computes
the sum of data in tows and the sum of data in columns of
the 3x3 (three by three) array variable n[3][3].
Answer Posted / rowel baldemoro
#include<stdio.h>
#include <conio.h>
#include <windows.h>
#include <iostream>
using namespace std;
void design(int x, int y){
COORD coord;
coord.X=x;
coord.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
int main()
{
int no[3][3],sum[2][3];
//1x3
design(1,0);
cin>>no[0][0];
design(4,0);
cin>>no[0][1];
design(7,0);
cin>>no[0][2];
sum[0][0]=no[0][0]+no[0][1]+no[0][2];
design(8,0);
printf("=%d",sum[0][0]);
//2x3
design(1,2);
cin>>no[1][0];
design(4,2);
cin>>no[1][1];
design(7,2);
cin>>no[1][2];
sum[0][1]=no[1][0]+no[1][1]+no[1][2];
design(8,2);
printf("=%d",sum[0][1]);
//3x3
design(1,4);
cin>>no[2][0];
design(4,4);
cin>>no[2][1];
design(7,4);
cin>>no[2][2];
sum[0][2]=no[2][0]+no[2][1]+no[2][2];
design(8,4);
printf("=%d",sum[0][2]);
sum[1][0]=0;
for(int i=0;i<3;i++){
design(1,6);
sum[1][0]=sum[1][0]+no[i][0];
cout<<sum[1][0];
}
design(4,6);
design(7,6);
getch();
}
Is This Answer Correct ? | 10 Yes | 4 No |
Post New Answer View All Answers
How to swap two ASCII numbers?
Create a program to read two random data set in two files named data1.txt and data2.txt manifold contains integer numbers, whereas data2.txt file contains the float type numbers. Simpanlahmasing each into 2 pieces of data that is an array of type integer array and an array of type float, then calculate the average numbers in the second array.
write a program to convert temperature from fa height into celcius and vise versa,use modular programming
write a program to perform generic sort in arrays?
Question 1: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date. *This Should Be Done IN C++
i don't know about working of nested for loop can any one help me
write a program that can LOCATE and INSERT elements in array using c++ programming languages.
U hv to enter a range from a and b and search hw many no. of times a pattern n. occurs between the range a and b. Eg :i/p:enter range :0 100 Enter pattern: 13 o/p: the no. times 13 occurred betwwn 0 to 100:1 Eg :i/p:enter range :100 1000 Enter pattern: 13 o/p: the no. times 13 occurred betwwn 100 to 1000: (in this 13,113,131,132,133…139,213,313,…913 all these will be counted)
develop a program to calculate and print body mass index for 200 employees
find level of following tree (state, parent) " J,D I,D H,C E,B F,B G,C B,A D,A C,A A,& K,E L,E L,F M,F N,G O,H P,I P,H Q,I R,J S,K U,P T,L
What output does this program generate as shown? Why? class A { A() { cout << "A::A()" << endl; } ~A() { cout << "A::~A()" << endl; throw "A::exception"; } }; class B { B() { cout << "B::B()" << endl; throw "B::exception"; } ~B() { cout << "B::~B()"; } }; int main(int, char**) { try { cout << "Entering try...catch block" << endl; A objectA; B objectB; cout << "Exiting try...catch block" << endl; } catch (char* ex) { cout << ex << endl; } return 0; }
write a program using 2 D that searches a number and display the number of items 12 inputs values input 15,20, 13, 30, 38, 40,16, 18, 20 ,18 ,20 enter no. to search : 20
Code for Easily Using Hash Table?
create a stucture student containing field for roll no,class,year and marks.create 10 student annd store them in a file
Write a simple encryption program using string function which apply the substitution method.