Question

Must be done in C++ 2013 microsoft visual studio Write a program that creates a 4...

Must be done in C++ 2013 microsoft visual studio

Write a program that creates a 4 x 5 two-dimensional array. The program should use loops to populate the array using the rand, srand and time functions with random numbers between 10 and 60. After the values have populated the array, output the values of the array to the screen in something that looks like a 4 x 5 table.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

below i written complete C++ code as per the requirement.

Please note the below program has been tested on ubuntu 16.04 system and compiled using g++ compiler. This code will also work on code blocks and visual studio.

-----------------------------------------------------------------------------------------------------------------------------------

Program:

------------------------------------------------------------------------------------------------------------------------------------

#include<iostream>

#include<ctime>

#include<cstdlib>

using namespace std;

int main()

{

srand(time(0));

int matrix[4][5];

//generate matrix of 4 x 5

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

{

for(int j = 0; j<5; j++)

{

matrix[i][j] = 10+rand()%60;

}

}

cout<<"Generated 4x5 Matrix is: "<<endl;

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

{

for(int j = 0; j<5; j++)

{

cout<<matrix[i][j]<<" ";

}

cout<<endl;

}

return 0;

}


==============================================================

Sample Output:

=================================================================

KIndly Check and Verify Thanks..!!!

Add a comment
Know the answer?
Add Answer to:
Must be done in C++ 2013 microsoft visual studio Write a program that creates a 4...
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
  • I need help creating a program in Visual Basic, (I'm using Visual Studio 2013), that will...

    I need help creating a program in Visual Basic, (I'm using Visual Studio 2013), that will start with a screen welcoming people to a student database management system. It will then ask them to click next to take them to another screen that will have 5 tabs. Student enquiry, Registration, courses, faculty, and fee payments. Depending on what is clicked will take them to that screen and have information related to that on that screen. It doesnt have to be...

  • Write a c# program in Microsoft visual studio to determine if the following numbers are even...

    Write a c# program in Microsoft visual studio to determine if the following numbers are even or not. Create an app that will read integers from an input file name Number.txt that will consist of one integer. Determine which numbers are even and which are odd. Write the even numbers to a file named Even.txt and the odd numbers to a file named Odd.txt. Number.txt 20 39 45 12 31 62 10 11 21 73 14 42 55 86 109...

  • Program must be in C language and MUST be able to run on visual studio 2....

    Program must be in C language and MUST be able to run on visual studio 2. Using Pointers and Arrays 2.1 Write a function bubblesort which will accept an array of double precision floating point numbers of length N and sort the array. Ref: https://en.wikipedia.org/wiki/Bubble_sort (I can verify this is accurate) 2.2 Write a program which exercises the bubblesort. For a good test, the program should have more than 20 values.

  • c++ help Write a program that: Creates two finite arrays of size 10 These arrays will...

    c++ help Write a program that: Creates two finite arrays of size 10 These arrays will serve as a storing mechanism for student grades in Classes A and B Uses a loop to populate the arrays with randomly generated numbers from 0 to 100.These numbers will represent student grades. Compute average grade of each class. Finally, output the two arrays and the message with two averages and best class. ("Class A average is: 65.43; class B average is: 68.90. Class...

  • Write a program using C in Microsoft visual studios. Write a function that receives an array...

    Write a program using C in Microsoft visual studios. Write a function that receives an array of integers and the array length and prints one integer per line (Hint: Use \n for a line break). Left align all of the integers and use a field width of 10. Populate an array of 10 elements from the user and pass the array and its length to the function.

  • using Microsoft Visual Studio C++ write a compute program that will allow the user to: 1.Get...

    using Microsoft Visual Studio C++ write a compute program that will allow the user to: 1.Get a Factorial (using a loop) 2. perform addition and subtraction 3.allow the user to quit the program

  • Please write below code in C++ using Visual Studio. Write program that uses a class template...

    Please write below code in C++ using Visual Studio. Write program that uses a class template to create a set of items. The program should: 1. add items to the set (there shouldn't be any duplicates) • Example: if your codes is adding three integers, 10, 5, 10, then your program will add only two values 10 and 5 • Hint: Use vectors and vector functions to store the set of items 2. Get the number of items in the...

  • Has to be written in C++. Visual studio. Write a C++ program to realize the game...

    Has to be written in C++. Visual studio. Write a C++ program to realize the game of guessing the number. Generally, the game will generate a random number and the player has to find out the number. In each guess, the program will give you a feedback as your guess is correct, too large, or too small. Then the player play repetitively until find out the number. Specifically, the game plays as the following. a). When the game is started,...

  • C++ and Using Microsoft Visual Studio. Write 2 programs: One program will use a structure to...

    C++ and Using Microsoft Visual Studio. Write 2 programs: One program will use a structure to store the following data on a company division: Division Name (East, West, North, and South) Quarter (1, 2, 3, or 4) Quarterly Sales The user should be asked for the four quarters' sales figures for the East, West, North, and South divisions. The data for each quarter for each division should be written to a file. The second program will read the data written...

  • Using assembly language in microwoft visual studio write the following code with procedure with c...

    using assembly language in microwoft visual studio write the following code with procedure with correct number of Fib numbers Your program should detect the largest Fib number that can be calculated. Besides storing the result in an array, print them on the screen.

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