Question

Assignment Input from the user 9, 64-bit, floating-point values as a 3x3, row-major, multi-dimensional array. This will be th

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

ans...............................


#include <iostream>
using namespace std;
int main()
{
//Declare a matrix array
double matrix[3][3];
//Declare a vector array
double vector[3];
//Varible for sum
double result=0;
//Variable for continuation
char ch;
//Loop until user choose no
while (true) {
result = 0;
//Input matrix values
cout << "Enter matrix values: ";
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
cin >> matrix[i][j];
}
}
//Input vector values
cout << "Enter vector values: ";
for (int i = 0; i < 3; i++) {
cin >> vector[i];
}
//Print result vector
cout << "Result = [";
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
result += matrix[i][j] * vector[i];
}
if (i < 2) {
cout << result << ", ";
result = 0;
}
else {
cout << result << "]" << endl;
}
}
//Loop repetition question
cout << "Go again (y/n)? ";
cin >> ch;
//Error check
while (ch != 'y' && ch != 'Y' && ch != 'n' && ch != 'N') {
cout << "Go again (y/n)? ";
cin >> ch;
}
//If not exit
if (ch == 'N' || ch == 'n') {
break;
}
}
  
}
output:

HSave Debug | Stop @Share {} Beautify Run main.cpp OnlineGDB 1 beta 2 //Header files #include tinstream> online compiler and

Add a comment
Know the answer?
Add Answer to:
Assignment Input from the user 9, 64-bit, floating-point values as a 3x3, row-major, multi-dimensional array. This...
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
  • IN C#.Develop a program that prints out the location of the largest value in a two-dimensional...

    IN C#.Develop a program that prints out the location of the largest value in a two-dimensional array. The largest values may appear more than once in the array, so you must only print out the first instance. The program defines method locateLargest() that takes a two-dimensional array of integers and returns the location (row index and column index) of the first largest value as a single-dimensional array. The program main method prompts the user to enter a 3-by-4 matrix, prints...

  • Instructions Write a C++ program that performs the following: Accept a list of floating point values...

    Instructions Write a C++ program that performs the following: Accept a list of floating point values on a single line (separated by spaces). This is vector A. The user may enter as many values as they desire. Accept a second list of floating point values on a single line (separated by spaces). This is vector B. The user may enter as many values as they desire. There is no requirement that the two vectors have the same number of elements....

  • Calculator Project

    AssignmentYou will be designing a calculator complete with user interface to take input from the user, process a response, and produce the output.Step 1: Present a menuFirst thing you should do is present a menu to the user when your program is first ran. Make sure that the operations match the numbers presented below, otherwise the graders won't be able to grade your program.1. Cartesian distance 2. Vector x matrix 3. Normalize 4. Quit Enter command:You will present the menu and wait for the user to input their...

  • I should use the array and loop to create a java program according to the instruction,...

    I should use the array and loop to create a java program according to the instruction, but I have no idea how to do it. Introduction This lab assignment continues to give you practice using loops, particularly loops with variable termination conditions, and it also provides you an opportunity to use one-dimensional arrays. Recall that an array is used to store a collection of data. The data can be values of Java primitive data types or else objects (for instance,...

  • Program in C++! Thank you in advance! Write a menu based program implementing the following functions: (1) Write a funct...

    Program in C++! Thank you in advance! Write a menu based program implementing the following functions: (1) Write a function that prompts the user for the name of a file to output as a text file that will hold a two dimensional array of the long double data type. Have the user specify the number of rows and the number of columns for the two dimensional array. Have the user enter the values for each row and column element in...

  • MUST BE WRITTEN IN C++ All user input values will be entered by the user from...

    MUST BE WRITTEN IN C++ All user input values will be entered by the user from prompts in the main program. YOU MAY NOT USE GLOBAL VARIABLES in place of sending and returning data to and from the functions. Create a main program to call these 3 functions (5) first function will be a void function it will called from main and will display your name and the assignment, declare constants and use them inside the function; no variables will...

  • Write a menu based program implementing the following functions: (0) Write a function called displayMenu that...

    Write a menu based program implementing the following functions: (0) Write a function called displayMenu that does not take any parameters, but returns an integer representing your user's menu choice. Your program's main function should only comprise of the following: a do/while loop with the displayMenu function call inside the loop body switch/case, or if/else if/ ... for handling the calls of the functions based on the menu choice selected in displayMenu. the do/while loop should always continue as long...

  • Write a program in MIPS assembly language that implements the DESCENDING bubble sort algorithm to sort a variable-sized array of signed 32-bit integers

    Write a program in MIPS assembly language that implements the DESCENDING bubble sort algorithm to sort a variable-sized array of signed 32-bit integers (words)that are read from the console. Be reminded that in a descending sort, the integers are sorted from the largest to the smallest. A “special value” 99999 will beused to signify the end of the input sequence. This value is not to be considered part of the input data set. However, any value greater than 99999 that...

  • P7.5– A theater seating chart is implemented as a two-dimensional array of ticket prices, like this:...

    P7.5– A theater seating chart is implemented as a two-dimensional array of ticket prices, like this: 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 20 20 20 20 20 20 10 10 10 10 20 20 20 20 20 20 10 10 10 10 20 20 20 20 20 20 10 10 20 20 30 30...

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