1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
GuDViN [60]
3 years ago
9

Write and debug this program in Visual C++, and upload for grading. Declare a 2D array, 4 rows by 3 columns, initialized to all

zeros. The program should prompt for and read a list of integers into the 2-dimensional array It should stop reading in new values when the user types a non-numeric or at 12 numbers, whichever comes first.
Then the program should print out:
• the average of the values entered
• the maximum value entered
• the array as a 4x3 matrix with spacing of 3 spaces per column (Hint: setw(3))
• the array transposed, as a 3x4 matrix (just print it in transposed order, do not create an actual 3x4 array. To print it transposed, just copy the nested loop that printed it as 4x3, and make the outer loop the columns and inner loop the rows)
Example program run the program prints everything below except the user input, whch is 1 2 3 4 5 6 74
Enter up to 12 integers, separated by spaces, terminated with a non-numeric: 1 2 3 4 5 6.79
Average - 4
Maximum
4x3 matrix
1 2 3
4 5 6
7 0 0
0 0 0
3x4 matrix
1 4 7 0
2 5 0 0
3 6 0 0
Computers and Technology
1 answer:
Ahat [919]3 years ago
3 0

Answer:

See explaination

Explanation:

#include <iostream>

#include <iomanip>

using namespace std;

int main( )

{

//2D array with 4 rows and 3 columns and initializing it with zeros

int arr[4][3]={0};

int i,j;

//for taking input

int x;

//for counting number of numeric inputs

int cnt=0;

//for storing maximum value

int maxi=0;

//for storing sum of all numeric values

float sum=0;

cout<<"Enter up to 12 intergers,seperated by spaces, terminated with a non-numeric:\n";

//taking 12 inputs

for(i=0;i<4;i++){

for(j=0;j<3;j++){

//taking input in x

cin>>x;

//if input is non-numeric then break

if(x==0){

break;

}

//counting the number numeric inputs

cnt++;

//calculating sum of all numeric values

sum+=x;

//finding maximum among all numeric values

maxi=max(maxi,x);

//storing the input in 2D array

arr[i][j]=x;

}

//if input is non-numeric then break

if(x==0){

break;

}

}

//calculating average of all numeric values

float avg=sum/cnt;

//displaying average and maximum

cout<<"Average = "<<avg<<"\n";

cout<<"Maximum = "<<maxi<<"\n";

//displaying 4x3 matrix

cout<<"4x3 matrix:\n";

for(i=0;i<4;i++){

for(j=0;j<3;j++){

cout<<arr[i][j]<<setw(3);

}

cout<<"\n";

}

//displaying transpose of matrix

cout<<"3x4 matrix:\n";

for(i=0;i<3;i++){

for(j=0;j<4;j++){

cout<<arr[j][i]<<setw(3);

}

cout<<"\n";

}

return 0;

}

You might be interested in
True or false
Semmy [17]
It’s false I hope this helped you
3 0
3 years ago
what types of physical drives does windows disable defragmenting, but provides another method of optimization?
Anika [276]

The type of physical drives does windows disable defragmenting, but provides another method of optimization is known as windows.

<h3>What is windows?</h3>

It should be noted that windows is a separate viewing area on a computer display screen in a system.

In this case, the type of physical drives does windows disable defragmenting, but provides another method of optimization is known as windows.

Learn more about window on:

brainly.com/question/25243683

#SPJ12

4 0
2 years ago
Distinguish among packet filtering firewalls, stateful inspection firewalls, and proxy firewalls. A thorough answer will require
4vir4ik [10]

Answer:

packet filtering

Explanation:

We can use a packet filtering firewall, for something like this, reasons because when visiting a site these types of firewalls should block all incoming traffic and analyze each packet, before sending it to the user. So if the packet is coming from a malicious origin, we can then drop that packet and be on our day ;D

7 0
4 years ago
Huzaifa is a grade 5 student who is very enthusiastic to learn coding in computers. He asks his computer teacher to help him cho
GaryK [48]

Answer:

High level language.

Explanation:

High level language can be defined as a programming language which is generally less complex than a machine (low level) language and easy to understand by the end users (programmers).

This ultimately implies that, a high level programming language is typically a user friendly language and as such simplifies coding or programming for beginners.

Some examples of high level programming language are Python, Java, C#, Ruby, Perl, Visual Basic, PHP, Cobol, C++, Fortran, Javascript, etc.

In this scenario, Huzaifa is a grade 5 student who is very enthusiastic to learn coding in computers. He asks his computer teacher to help him choose a language to code. Thus, the language level the teacher will recommend to Huzaifa is a high level language.

3 0
3 years ago
A license plate consists of 2 letters followed by 1 digit. How many license plates are possible if the first letter can be any l
Art [367]

Answer:

5400

Explanation:

  • As there are three spaces to be filled. First can have any alphabet, but not i and o. And there are 26 alphabets so, only one out of 24 can be filled in the first blank.
  • In the second blank any alphabet can be used, but not the one same as the first one so we can choose from the remaining 25 alphabets.
  • In the last blank any number can be chosen, but not 0 so we have 9 options to choose from.

Finally,the number of options available is <em>24*25*9 = 5400</em>. So, 5400 license plates can be made using these combinations.

8 0
3 years ago
Other questions:
  • What so the term used to describe how many bits are used in each pixel?
    7·1 answer
  • The protocol that enables computers on the Internet to communicate with one another is called _____.
    10·2 answers
  • Robin ensures that she is always available if anyone in the team needs her. Which quality is shown by robin?
    9·2 answers
  • __________ has become a widely accepted evaluation standard for training and education related to the security of information sy
    5·1 answer
  • The rules of right-of-way<br> Pedestrians, bicyclists, and skateboarders<br> when they use the road.
    12·1 answer
  • What is gained by increasing the ritation speed of a disk or cd?​
    9·1 answer
  • Which of these five are Netflix Originals?1/5
    5·1 answer
  • Explain the integer and float datatypes with example.<br><br>​
    11·1 answer
  • ANYONE WANNA FRIEND ME ON DISCORD ゴRose joestarゴ#2088
    9·1 answer
  • Select the function of keypunches that were used as one of the earliest input devices. A. It was used to control the cursor on t
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!