Question

C++ program Write code that will fill the array a (declared next) with numbers typed in...

C++ program

Write code that will fill the array a (declared next) with numbers typed in at the

keyboard. The numbers will be input five per line, on four lines (although your

solution need not depend on how the input numbers are divided into lines).

int a[4][5];

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <stdio.h>

int main() {
    int a[4][5];
    int i, j;
    for (i = 0; i < 4; ++i) {
        for (j = 0; j < 5; ++j) {
            scanf("%d", &(a[i][j]));
        }
    }
    return 0;
}
Add a comment
Know the answer?
Add Answer to:
C++ program Write code that will fill the array a (declared next) with numbers typed in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 9. Write some C++ code that will fill an array a with 20 values of type...

    9. Write some C++ code that will fill an array a with 20 values of type int read in from the keyboard. You need not write a full program, just the code to do this, but do give the declarations for the array and for all variables. 10. Suppose you have the following array declaration in your program: int your_array[7]; Also, suppose that in your implementation of C++, variables of type int use two bytes of memory. When you run...

  • Three C Code Questions: 5. Write a C program that declares an array of 10 strings,...

    Three C Code Questions: 5. Write a C program that declares an array of 10 strings, each of max length 50 characters, and then reads an entire line of text from the keyboard into each string. 6. Write C code that finds the longest name in this array of strings that you read in Q5. Hint: find the position of the longest string, not the string itself. 7. Write a C program that creates a 4 x 6 two dimensional...

  • Please I need code in C++ Write a program that creates an int array of size...

    Please I need code in C++ Write a program that creates an int array of size 10, then uses a for-loop to populate the array with numbers from your favorite number pattern.

  • // Program takes 5 numbers from a user (from console), stores them into an // array,...

    // Program takes 5 numbers from a user (from console), stores them into an // array, and then prints them to the screen (on the same line). // Add code to complete this program. You only need to add code where indicated // by "ADD HERE". #include <iostream> using namespace std; int main() { const int SIZE = 5; // size of array // ADD HERE - create an array of integers that will hold 5 integers. cout << "please...

  • Write a program in C++ language that finds the largest number in an array of positive...

    Write a program in C++ language that finds the largest number in an array of positive numbers using recursion. Your program should have a function called array_max that should pass in an int array, and an int for the size of the array, respectively, and should return an int value. As an example, given an array of size 10 with contents: {10, 9, 6, 1, 2, 4, 16, 8, 7, 5} The output should be: The largest number in the...

  • Given an array of integers as declared below, write C loop to fill it up (assign,...

    Given an array of integers as declared below, write C loop to fill it up (assign, store) with the numbers 1-100 column by column, i.e. a[0][0] = 1; a[1][0] = 2;... Use only the variables below as printed do not write them again. Just write the two loops. int a [10][10]; int value = 1; int r,c;

  • ***Please complete the code in C*** Write a program testArray.c to initialize an array by getting...

    ***Please complete the code in C*** Write a program testArray.c to initialize an array by getting user's input. Then it prints out the minimum, maximum and average of this array. The framework of testArrav.c has been given like below Sample output: Enter 6 numbers: 11 12 4 90 1-1 Min:-1 Max:90 Average:19.50 #include<stdio.h> // Write the declaration of function processArray int main) I int arrI6]i int min-0,max-0 double avg=0; * Write the statements to get user's input and initialize the...

  • (C++ programming) Need help with homework. Write a program that can be used to gather statistical...

    (C++ programming) Need help with homework. Write a program that can be used to gather statistical data about the number of hours per week college students play video games. The program should perform the following steps: 1). Read data from the input file into a dynamically allocated array. The first number in the input file, n, represents the number of students that were surveyed. First read this number then use it to dynamically allocate an array of n integers. On...

  • 29. (20 points) Write the complete C++ program that implements the following program, as if you...

    29. (20 points) Write the complete C++ program that implements the following program, as if you were turning this in for homework. Your program should have a commented header (your name, etc), comments within the program and a well-built display for the output. Don't forget the pre-processor commands Define an array called nums with a maximum of 20 integers, and fill the array with numbers, recei the keyboard (prompt for the numbers.) In this program, exactly 20 integers will be...

  • This is a fill in the code type: // FILL IN THE CODE - Write a...

    This is a fill in the code type: // FILL IN THE CODE - Write a program to multiply 2 numbers, print out the results and print out the original numbers in ascending order. #include <iostream> using namespace std; int main() {   int num1;       // holds 1st number   int num2;       // holds 2nd number   int result;       // holds result of multiplication   int *num1Ptr = nullptr; // int pointer which will be set to point to the 1st number   int *num2Ptr...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT